It depends.
First, the whole scenario you describe is a bit strange given the timing, if you're talking about allopathic programs. Rank lists are due next week, and quotas are set, so it would be strange for programs to be offering up spots like this. You could be talking about DO programs (since their match is done). It matters because there is a rule for DO programs in their program requirements which states:
7.4 A trainee who breaches his or her contractual commitment prior to the start of training shall not serve in an AOA-approved program for a period of twelve (12) months following the date of the breach. A trainee who breaches the trainee contract during his/her training shall not serve in an AOA-approved internship or residency until the beginning of the following training year (effective July 1st).
If the first program argues that quitting after signing a letter of agreement (which probably states that you're not going to look for any more positions) is a contract violation, you could lose all spots.
In reality, your question depends on whether you want to know if it's legal to do so, or ethical to do so.
It's not legal, but there may be very little a program can do to you for doing it. It's simply not worth the time and effort to take you to court, and hard to know if a program could prove financial damages, and seems unlikely that you'd be able to pay. But they could, and make your life miserable. Even if you "win", it could be painful and expensive.
Whether it's ethical is a personal question.
My feeling is this: You're a grownup. Grown ups have to make tough decisions. This is one of them. Sign the letter and take the first spot, and give up the second. Or don't sign and try to get the second, but take a risk of getting nothing. Choose, and don't try to scam the system.