Your best option is to tell your buyer's agent that you'll buy the home for the 40k lower number, or find another property to make an offer on. You can list a home for anything you wish, but with an appraisal 40k below what the seller is asking, the seller has to realize that he or she will never sell it for that higher amount. Remember, the situation in the residential real estate market has changed dramatically from the boom years between 2000-2005 and this is a buyer's market. If you walk away it could be months or years before another buyer comes along.
While you're at it, you may look for another agent - one who will bring a fair offer on your behalf instead of someone who is only interested in maximizing their commission.
It all depends on the type of financing you're using (i.e. cash, conventional loan, FHA loan, VA loan, etc.). If you are not paying all cash, you are allowed to pay the difference between appraised value and purchase price in cash unless you are using VA financing. (VA financing requires that the property appraise 100% of purchase price). Now, if you don't want to (or are unable to) pay the difference in cash, your Realtor can do an Addendum to the puchase contract to see if the seller will lower the price to appraised value - or you and the seller could meet somewhere in the middle. If none of these scenarios work, then you will need to cancel contract if you can't finance the property.