Hi there!
Recall the conservation of momentum:
[tex]\large\boxed{m_1v_1 + m_2v_2 = m_1v_1' + m_2v_2'}}[/tex]
For this type of inelastic collision:
[tex]\large\boxed{m_1v_1 + m_2v_2 = v_f(m_1 + m_2)}}[/tex]
Thus, the initial momentum equal the final momentum if there are no external forces.
We can begin by writing out this problem:
[tex]2 + 6 = v_f(m_1 + m_2)[/tex]
[tex]8 = 2(m_1 + m_2)\\\\m_1 + m_2 = \boxed{4 kg}[/tex]