The correct answer is: Cl; it takes much more energy to pull an electron away from a valence shell that is nearly full.
Chlorine (Cl) has a higher ionization energy than magnesium (Mg) because chlorine has a valence shell that is closer to being full (with 7 valence electrons) compared to magnesium, which has 2 valence electrons. It takes more energy to remove an electron from an atom with a nearly full valence shell than from an atom with fewer valence electrons.