The purpose of this exercise is to show that results obtained by considering mass $m$ and the left spring as a single oscillator are consistent with those obtained by considering mass $m$ alone in the top figure or masses $m$ and $M$ together in the bottom figure.
In the top figure, the forces acting on the oscillator are from the left wall and the right spring. If the displacement of mass $m$ from equilibrium is $x$, then the force from the left wall is $-kx$ (as the left spring exerts the force $kx$ on the left wall). Similarly, the force from the right spring is $-kx$, and the total force on the oscillator is $-2kx$. As $m\ddot x=-2kx$, the motion is harmonic in nature and consistent with what we would have obtained had we considered mass $m$ alone.
In the bottom figure, the forces acting on the oscillator are from the left wall and the rod connecting to mass $M$. If the displacement of mass $m$ from equilibrium is $x$, then the force from the left wall is $-kx$. On the other hand, mass $M$ moves with acceleration $\ddot x$ and experiences the force $M\ddot x$ from the rod. Consequently, the rod exerts the force $-M\ddot x$ on the oscillator, and the total force on the oscillator is $-kx-M\ddot x$. As