Rest masses do not add linearly - that's one of the awkward things about mass, and they are not conserved in processes and reactions.
You can easily understand this by thinking of the simple case where two masses approach one another at the same speed (relative to the measurement frame), so that the total momentum is nought. The rest mass of the system equals the total energy, which is the sum $2\,m$ of the rest masses together with the kinetic energy (multiplied by $c^2$, if you're not using natural units). So the rest mass of the whole is greater than the sum of the rest masses of the bits. Another simple example: two photons approaching one-another: sum of the rest masses is zero, but the rest mass of the whole system is the total energy of the two photons combined.
To your specific problem: IF you can be sure that the only "reaction" product is the fused masses smacked together (in particular, that there is no radiation - electromagnetic, acoustic or otherwise), then you can find the rest mass of the fused system simply by equating the components of the four-momentum before and after the collision. If the approach speeds of masses $m_1,\,m_2$ are $v_1,\,v_2$, and if the sought final velocity (a signed real in this one dimensional case) and rest mass are written $v$ and $m$ respectively, then this four-momentum equation is going to give you (in SI or other non-natural units):
$$m_1^2 c^2 = \frac{E_1^2}{c^2} -p_1^2\tag{1}$$
$$m_2^2 c^2 = \frac{E_2^2}{c^2} -p_2^2\tag{2}$$
$$m^2 c^2 = \frac{E^2}{c^2} -p^2\tag{3}$$
$$p_1 = m_1\,\gamma_1\,v_1;\quad p_2 = -m_2\,\gamma_2\,v_2;\quad p = m\,\gamma\,v\tag{4}$$
$$E=E_1+E_2\tag{5}$$
$$p = p_1+p_2\text{ (watch the signs!)}\tag{6}$$
and you can use this set to eliminate $\gamma\,v$ and derive the new rest mass $m$ in terms of $m_1,\,m_2,\,\gamma_1\,v_1$ and $\gamma_2\,v_2$