Suppose we are watching the motion in center of mass reference frame.
Let amplitude of mass be a.
By the the time mass m moves by a distance a The car will move a distance of
a' such that
am=a'M
and a+a'=xo
So a = Mxo/(M+m)
When the mass is displaced from its mean position by distance a restoring force of kxo acts on it
So F=-kxo= -(k(M+m)/M)a
So frequency of oscilation
f = (1/2pi)*sqrt((k(M+m)/M)/m)
=(1/2pi)*sqrt(k*(M+m)/(M*m))
And time period = 1/f