Step 1: Set up positions.
Two masses $m_1$ and $m_2$ (with $m_1 > m_2$) sit a distance $d$ apart. Place $m_1$ at position $0$ and $m_2$ at position $d$ on a line.
Step 2: Recall the centre of mass formula.
The centre of mass position is the mass weighted average: $x_{cm} = \dfrac{m_1 x_1 + m_2 x_2}{m_1 + m_2}$.
Step 3: Find the first centre of mass.
With $m_1$ at $0$ and $m_2$ at $d$: $x_{cm,1} = \dfrac{m_1(0) + m_2(d)}{m_1 + m_2} = \dfrac{m_2 d}{m_1 + m_2}$.
Step 4: Swap the masses.
Now put $m_2$ at $0$ and $m_1$ at $d$: $x_{cm,2} = \dfrac{m_2(0) + m_1(d)}{m_1 + m_2} = \dfrac{m_1 d}{m_1 + m_2}$.
Step 5: Find the shift.
The shift is the difference of the two centre positions: $|x_{cm,2} - x_{cm,1}| = \dfrac{(m_1 - m_2) d}{m_1 + m_2}$.
Step 6: Interpret it.
The centre of mass slides toward the side where the heavier mass now sits, by this amount. \[ \boxed{\left(\dfrac{m_1 - m_2}{m_1 + m_2}\right) d} \]