In the ground state of the atoms, the orbitals are filled in the order of their increasing energies. That is the electrons first occupy the lowest energy orbital available to them. Once the lower energy orbitals are completely filled, then the electrons enter the next higher energy orbitals.
The order of filling of various orbitals as per Aufbau principle is –
1 s < 2s < 2p < 3s < 3p < 4s < 3d < 4p < 5s < 4d …
For e.g., K (Z =19)
The electronic configuration is 1s2 2s2 2p6 3s2 3p6 4s1 . After filling 4s orbital only we have to fill up 3d orbital.