In the typical scenario for simple harmonic motion, we have a spring providing a restoring force back to the equilibrium position. This gives rise to the equation (for undamped SHM)
$$\ddot x +\frac {k}{m}x =0$$
Where here $k $ is a positive quantity.
This gives rise to the solution $x=A\cos(\omega t + \phi ) $ where $A $ is a positive quantity and $\omega$ is the angular frequency.
My question is, if we had a force where $k $ was negative, so the force acting on the particle displaced from equilibrium pushed it back further from equilibrium, mathematically we would still get the same solution and get SHM, or graph would just be flipped in the y axis but would still be a cosine graph. Why does the mathematics not reflect the fact that we would actually have a particle linearly accelerating away from the equilibrium and not undergoing any kind of oscillatory motion?