Optimal Remedies for Bilateral Contracts