To keep the COM at the same position, velocity of COM is zero, so
$\frac{m_{1}\,\vec{v}_{1}+m_{2}\,\vec{v_{2}}}{m_{1}+m_{2}}=0$
(where $\vec{v}_{1}$ and $\vec{v}_{1}$ are velocities of particles 1 and 2 respectively.]
$\Rightarrow m_{1} \frac{d \vec{r}_{1}}{dt}+m_{2} \frac{d \vec{r}_{2}}{dt}=0$
$\vec{\left[\because \vec{v}_{1}=\frac{d \vec{\vec{r}_{1}}}{dt} \,\&\, \vec{v}_{2}=\frac{d \vec{r}_{2}}{dt} \right]}$
$\Rightarrow m\,d\,\vec{r}_{1}+m_{2}d\,\vec{r}_{2}=0$ [$d\,\vec{r}_{1}$ and $d\,\vec{r}_{1}$ represent the change in displacement of particles]
Let 2nd particle has been displaced by distance $x$.
$\Rightarrow m_{1}\left(d\right)+m_{2}\left(x\right)=0 \Rightarrow x=-\frac{m_{1}d}{m_{2}}$
-ve sign shows that both the particles have to move in opposite directions.
So, $\frac{m_{1}d}{m_{2}}$ is the distance moved by 2nd particle to keep COM at the same position.