The atomic number of potassium,K is 19. Therefore, K+ (one electron release)=18, So, the electronic configuration of K+ ion is 1s22s22p63s23p6.
The atomic number of Cl is 17. Therefore , Cl- (one electron gain)=18 , So, the electronic configuration of Cl- ion is 1s22s22p63s23p6.