Hallo,
\(v_{1f}= \frac{m_1 - m_2}{m_1+m_2} v_{1i}\)
\((m_1+m_2) \cdot v_{1f}= (m_1 - m_2)\cdot v_{1i}\)
\(m_1\cdot v_{1f}+m_2\cdot v_{1f}= m_1\cdot v_{1i} - m_2\cdot v_{1i}\)
\(m_2\cdot v_{1f}+m_2\cdot v_{1i}= m_1\cdot v_{1i} -m_1\cdot v_{1f}\)
\(m_2\cdot(v_{1f} + v_{1i})= m_1\cdot (v_{1i} - v_{1f})\)
\(m_2= m_1\cdot \dfrac{v_{1i} - v_{1f}}{v_{1i} + v_{1f}}\)