We have two masses, m_1 and m_2, connected
by a spring. At some time their velocities are v_1 and v_2 respectively.Because the system
as a whole does not move, the total momentum must be zero. Therefore, we can write that
m_1v_1=m_2v_2. We are also told that they oscillate with the same period, so they must
reach their maximum speeds at the same time. So, we can set m_1v_1max=m_2v_2max. Finally,
the maximum speed of an SHM oscilllator is v_max=omega A where omega is the angular frequency
and A is the amplitude of the oscillations. Using this, we can find the required result.