It happens sometimes that a payment does nto get applied after entering it.
There might be ways to keep the payment and add entries to “fix it”. But, the simplest way I have found to correct this is to:
Cancel the payment entry. Amend it. And apply it to the invoices in question.
Unapplied payment entries