A hirozontal force F works on a body of mass m1 and accelerates it by 5m/s^2. The same magnitude of horizontal force is exerted to another body of mass m2, which accerelates it by 2m/s^2. If m1 and m2 are combined, the acceleration provided by the force F is ...

m2 = (5/2) * m1 = 2.5 m1

m = m1 + m2.
Replace m2 with 2.5mi:
m = m1 + 2.5m1 = 3.5m1.

a = (1mi/3.5m1) * 5 = 1.43 m/s^2.