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<2 s<2 p<3 s<3 p<4 s<3 d<4 p<5 s<4 d \ldots\)
For e.g., \(K(Z=19)\)
The electronic configuration is \(1 s^{2} 2 s^{2} 2 p^{6} 3 s^{2} 3 p^{6} 4 s^{1}\). After filling 4 s orbital only we have to fill up 3d orbital.