Magnesium (Mg) has an atomic number of 12. What is the ground-state electron configuration of magnesium?

1s21p62s22p2
1s21p61d4
1s22s22p63s2
1s22s22p62d2