Amelia is a domestic novel taking place largely in London during 1733. It describes the hardships suffered by a young couple newly married. Against her mother's wishes, Amelia marries Captain William Booth, a dashing young army officer. The couple run away to London. In Book II, William is unjustly imprisoned in Newgate, and is subsequently seduced by Miss Matthews. During this time, it is revealed that Amelia was in a carriage accident and that her nose was ruined. Although this brings about jokes at Amelia's behalf, Booth refuses to regard her as anything but beautiful.
Amelia, by contrast, resists the attentions paid to her by several men in William's absence and stays faithful to him. She forgives his transgression, but William soon draws them into trouble again as he accrues gambling debts trying to lift the couple out of poverty. He soon finds himself in debtors' prison. Amelia then discovers that she is her mother's heiress and, the debt being settled, William is released and the couple retires to the country.
The second edition contains many changes to the text. A whole chapter on a dispute between doctors was completely removed, along with various sections of dialogue and praise of the Glastonbury Waters. The edition also contains many new passages, such as an addition of a scene in which a doctor repairs Amelia's nose and Booth remarking on the surgery (in Book II, Chapter 1, where Booth is talking to Miss Matthews).

Question: What finally gets Amelia and William out of debt?
Answer: Amelia being her mother's heiress gets them out of debt.
Alternative answer: amelias inheritance