The answer is $\frac{1}{m_1}$ and $\frac{1}{m_2}$.
I used the conservation of momentum (taking into consideration initial momentum is zero) , coefficient of restitution , and conservation of kinetic energy (since it is elastic collision) and did not approach to a solution.
