According to one of the rules of electronic configuration the maximum number of electrons that can be accomodated in the valence shell is 18. Thus M shell can hold a maximum of 18 electrons however in realty M valence shell can not hold more than 8 electrons. Actually each shell is further divided into subshell, and each subshell contains a given number of orbitals. There are four different types of subshells - the s subshell, p subshell, d subshell and f subshell. Each subshell has a specific number of orbitals, and so can hold a given number of electrons. Another important point to note is that these orbitals are filled in the increasing order of energy. It is because of this order (in which the atomic orbitals are filled) that the electronic configuration of of calcium is 2, 8, 8, 2 and not 2, 8, 9, 1 or 2, 8, 10.