A uniform cylinder of length $\ell$ and mass $M$ having cross-sectional area $A$ is suspended, with its length vertical, from a fixed point by a massless spring, such that it is half submerged in a liquid of density at equilibrium position. The extension of the spring when it is in equilibrium is:
(A) $\frac{M g}{k}\left(1-\frac{\ell A \sigma}{M}\right)$
(B) $\frac{M g}{k}\left(1-\frac{\ell A \sigma}{2 M}\right)$
(C) $\frac{M g}{k}\left(1+\frac{\ell A \sigma}{M}\right)$
(D) $\frac{M g}{k}$