To solve this problem we will first apply the principle of energy conservation, for which the elastic potential energy must be the same as the elastic kinetic energy of the simple harmonic movement of the system.
From this conservation it will be possible to find in total terms the total displacement of the system and thus replace it in the given function to find the time.
The potential energy stored would be

The kinetic energy would be

Here,


Now assuming the planned conservation of energy







So now using the equation previously given to describe the motion of the particle we have to





Therefore the correct option is B.