Given:
The mass of A is,
[tex]m_A=3\text{ kg}[/tex]The initial velocity of A is,
[tex]u_A=4\text{ m/s}[/tex]The initial velocity of B is,
[tex]u_B=-4\text{ m/s}[/tex]The final velocity of A is,
[tex]v_A=-21\text{ m/s}[/tex]The final velocity of B is,
[tex]v_B=-1\text{ m/s}[/tex]Applying the momentum conservation principle we can write,
[tex]\begin{gathered} m_Au_A+m_Bu_B=m_Av_A+m_Bv_B \\ 3\times4+m_B(-4)=3\times(-21)+m_B\times1 \\ 12-4m_B=-63+m_B \\ 5m_B=75 \\ m_B=15\text{ kg} \end{gathered}[/tex]Hence, the mass of B is 15 kg.