Mass m1 is F divided by a1 and mass m2 is F divided by a2. The combined acceleration is F divided by the total mass, which simplifies algebraically to a1 a2 divided by the sum of a1 and a2.
Home/same tractor pulls a trolley of mass m2 with a force f producing