When a nonqualified distribution is received from a Roth IRA, what is the deemed order of the funds distributed?

a) Earnings first, contributions second
b) Contributions first, earnings second
c) Earnings only
d) Contributions only