Two trolleys 1 and 2 are moving with accelerations a1 and a2