Let mass of object A and B be m1 and m1 respectively
Let their initial velocity be u1 and u2 Let their final velocity be v1 and v2
We know,
P = mv
Let their initial momentum be m1 u1 and m2 u2
Let their final momentum be m1v1 and m2v2
Total initial momentum = (m1u1 + m1u1)
Total final momentum = (m1v1 + m2v2)
If F2 is the force that acts on object B,

i.e. The magnitude of total of total final momentum = the magnitude of total initial momentum