Cooper and his children went into a bakery and where they sell cupcakes for $2.50 each and donuts for $1.50 each. Cooper has $40 to spend and must buy a minimum of 18 cupcakes and donuts altogether. If Cooper decided to buy 7 cupcakes, determine the maximum number of donuts that he could buy.