$$\require{cancel}$$
$\dfrac{d^2x}{dt^2}+\beta\dfrac{dx}{dt} + \dfrac{k}{m}x = 0$
The constant $$\beta$$ determines the contribution of the acceleration due to the drag force on the object. It is beyond the scope of this work to discuss how such differential equations are solved, but the solution will be given, and the reader is encouraged to plug the solution back into the differential equation to confirm that it works (actually, guessing-and-confirming is pretty much how such differential equations are solved!):
$x\left(t\right) = Ae^{-\frac{1}{2}\beta t}\sin\left(\omega t + \phi\right),\;\;\;\;\;\; where:\;\; \omega \equiv \sqrt{\dfrac{k}{m} - \frac{1}{4}\beta^2}$