Solution (source code)

= Solution

Put $R=R_A+R_B$, $c=\sqrt{R^2-b^2}/R$, and $s=b/R$. At impact the unit <vector> from A to B is $n=(-c,s)$. The <impulse> is normal, so tangential <velocity> is unchanged, while the normal components undergo a one-dimensional <elastic collision>. Therefore
$$
v_A=\frac{2M_B}{M_A+M_B}(u e_x\cdot n)n
=-\frac{2M_Buc}{M_A+M_B}n,
$$
$$
v_B=ue_x-\frac{2M_A}{M_A+M_B}(ue_x\cdot n)n
=ue_x+\frac{2M_Auc}{M_A+M_B}n.
$$