For anyone wondering, a credit memo is a credit note, which is defined by the Free Dictionary as "a commercial document issued by a seller to a buyer, listing the products, quantities and agreed prices for products or services the seller provided the buyer, but the buyer did not receive or returned. It may be issued in the case of damaged goods, errors or allowances..."
The second option above is correct.
Let's rewind first. Originally when purchasing the goods we would have done: Debit: Purchases Credit: Accounts Payable (liability)
When credit memo is received we would do the following entry: Debit: Accounts Payable (liability) Credit: Purchase Returns & Discounts
You could debit "Creditors" instead of "Accounts Payable" above if you want.
Why debit accounts payable? It is a liability and we owe them less (we do not owe them for the defective goods).
Why credit discount received? It's income. We saved money. We owe that much less. So it's considered income.
When we pay the creditor for the remaining 2 goods we do the usual:
Debit: Accounts Payable (liability) Credit: Bank (asset)