My husband and I both owe money to the irs. If we file married jointly and get a refund who’s tax debt will the refund go towards?

I owe 3,000 to the IRS and my husband owes $7,000. Our refund if we file jointly is around $5,000. Whose tax debt will that go towards? Will it pay off mine and then 2,000 towards his? Or all tomhis?