Both masses obey q̈ + (k/m)q = 0. The horizontal spring has no constant force shifting its equilibrium, while gravity moves the vertical equilibrium downward by mg/k.