(Error) The formula 2n2 gives the most electrons a shell can hold (2×32=18 for M), but another Bohr–Bury rule says the outermost shell can hold at most 8 electrons. In Pooja's diagram the M-shell is the outermost shell, and it has 10 electrons, which is more than 8, so it is not allowed.
(Correct configuration) Fill stepwise: K 2, L 8, then M takes 8 (the outermost limit). The outermost-shell rule must hold at every step: a 9th electron in M would make an outermost shell of 9, so the 19th and 20th electrons start the N-shell. The remaining 20−2−8−8=2 electrons go into the next shell, N. So calcium is 2, 8, 8, 2 (K 2, L 8, M 8, N 2).