Momentum is conserved, so \(\displaystyle m_1v_1+m_2v_2=m_1v_{init}\), where \(\displaystyle m_1\) and \(\displaystyle m_2\) are the masses, \(\displaystyle v_{init}\) is the initial velocity, and \(\displaystyle v_1\) and \(\displaystyle v_2\) are the final velocities. Since the collision is elastic, kinetic energy is also conserved, so \(\displaystyle \frac{1}{2}m_1v_1^2+\frac{1}{2}m_2v_2^2=\frac{1}{2}m_1v_{init}^2\).

I think you can solve it from there. You should get \(\displaystyle v_1=-1\) and \(\displaystyle v_2=2\), so wagon 1 bounces and is coming back the other direction at 1 m/s, and wagon 2 moves at 2 m/s.

- Hollywood