As shown in figure, a block A having mass $M$ is attached to one end of a massless spring. The block is on a frictionless horizontal surface and the free end of the spring is attached to a wall. Another block B having mass ' $\mathrm{m}$ ' is placed on top of block A. Now on displacing this system horizontally and released, it executes S.H.M. What should be the maximum amplitude of oscillation so that B does not slide off A? Coefficient of static friction between the surfaces of the block's is $\mu$.
(A) $A_{\max }=\{(\mu \mathrm{mg}) / \mathrm{k}\}$
(B) $A_{\max }=[\{\mu(m+M) g\} / k]$
(C) $A_{\max }=[\{\mu(M-\mathrm{m}) g\} / \mathrm{k}]$
(D) $A_{\max }=[\{2 \mu(M+m)\} / k]$