We can represent the problem as shown in the attached drawing
L1=x1
L2=x2
L=x------------distance of the center of mass
we have that
L1/L2=m2/m1------------------> L1*m1=L2*m2------------->m2=L1*m1/L2
moment = Md
the moment about O is defined to be
m1*L1+m2*L2=(m1+m2)*L
L=(m1*L1+m2*L2)/(m1+m2)
m1*L1+m2*L2=2*m1*L1--------remember-------------------->L1*m1=L2*m2
L=(2*m1*L1)/(m1+L1*m1/L2)
L=(2*m1*L1)/(m1*L2+L1*m1)/L2=(2*m1*L1)*L2/(L2*m1+L1*m1)
L=(2*L1*L2)/(L1+L2)
the coordinates of the center of mass are (L,0)