Frest ∝ -x
⇒ Frest = – kx … (1)
This equation shows the restoring force and displacement of the mass are proportional to each other and the direction of force is towards the equilibrium position. This is the condition for SHM and, therefore, the spring mass system executes simple harmonic motion.
Moreover, from the second law of motion, Frest = ma … (2)
Comparing (1) and (2), we have

Since k and m are both constants, therefore, k/m is also constant. Thus
a ∝ -x
Again this is condition of SHM. Therefore, the spring-mass system executes simple harmonic motion.