Momentum is conserved, so , where and are the masses, is the initial velocity, and and are the final velocities. Since the collision is elastic, kinetic energy is also conserved, so .

I think you can solve it from there. You should get and , so wagon 1 bounces and is coming back the other direction at 1 m/s, and wagon 2 moves at 2 m/s.

- Hollywood