I am assuming you didn't close yet on home number 1. If so, and you decide to just walk away from it you risk your escrow (deposit) to go after another house. If you have a property inspection contingency on home number 1, you may be able to use that as the reason for not purchasing the home and get your escrow back.
The bank probably doesn't care which property you purchase. It comes down to being under contract on one home but wanting to purchase another. Legally, you are bound to house number 1 unless there is a contingency you can use to break the contract. Consult with your real estate agent to decide how to go forward.
Long & Foster Real Estate, Inc
Lehigh Valley Office, PA