If there is no cash left to satisfy a bequest the courts will review all of the expenses, all of the bequests, and they are paid in a specific order as set forth in state law.
Generally, debts have to be paid before any distribution is made to a beneficiary.