We will have the following: since the collision is perfectly elastic then:
![m_1v_1+m_2v_2=m_!v_3+m_2v_4](https://img.qammunity.org/2023/formulas/physics/college/wkjxlwihoi90rpwgfkpwkvcwlxfiyjwrkd.png)
Now, we know that in an elastic collision the bodies won't have a net transfer of energy and the directions will be opposite but with the same magnitude:
So, the final velocities are:
10 kg object will have a final velocity of -2 m/s. And the 2 kg object will have a final velocity of 4m/s.
[We are assuming that the directions are positive for the initial direction of the 10 kg object and the 2kg mass initial velocity marks the opposite direction]