k,l,m represent the principal quantum number and s,p,d,f represent the azimuthal quantum number.
k stands for shell 1. It has only one shell, that is 1s. It can accommodate 2 electrons.
l stands for shell no.2. It has 2 subshells, 2s and 2p. 2s can accommodate 2 electrons and 2p can accommodate 6 electrons, total of 8 electrons in shell no.2.
m stands for shell no.3. It has 3 subshells, 3s, 3p and 3d. 3s can accommodate 2 electrons, 3p can accommodate 6 electrons and 3d 10 electrons, total of 18 electrons in shell no.3.
n stands for shell no.4. It has 4 subshells, 4s, 4p, 4d and 4f. 4s can accommodate 2 electrons, 4p can accommodate 6 electrons, 4d 10 electrons and 4f 14 electrons, total of 32 electrons in shell no.4.
These subshells are filled with electrons based upon their energy levels.Lower energy levels are filled first. It is explained by Aufbau principle.