how do I calculate mass of one object in an elastic collision?

I have the equation
m1v1 initial + m2v2 initial = m1v1 final + m2v2 final

How do I rearrange this to solve for m2?

With elastic collisions, both momentum and kinetic energies are conserved.

Let u=initial velocity, v=final velocity, then for momentum
m1u1 + m2u2 = m1v1 + m2v2 ....(1)
(same as the posted equation).
For energy considerations,
(1/2)m1u1² + (1/2)m2u2²
= (1/2)m1v1² + (1/2)m2v2²
which simplifies to
m1u1² + m2u2² = m1v1² + m2v2² ... (2)

The solution process depends on what is given. There can be up to two unknowns for which we can solve using the two given equations.