Mass is given as
Speed is given as
Mass of boy is given as
Initial momentum will be,
is final velocity of the trolley
Final velocity of boy can be calculated as,
According to law of conservation of energy, we have,
Initial momentum final momentum
Length
Distance moved by the trolley