The number of electrons present in K, L, M shell respectively is:
2,8,18
The number of electrons in any shell is given by the formula 2n2 where n is the number of shell. So substituting values of n as 1, 2,3 we get the number of electrons as 2, 8, 18.