Thanks, Nugatory.
When spring is stretched towards right, the force (restoring force) will be towards the left.
When spring is compressed towards left, the force (restoring force) will be towards the right.
What will be the direction of acceleration in both cases?