Since elements in group 1 only have 1 valence electron and elements in group 17 have 7 valence electrons, the one electron from the element in group 1 transfers to the group 17 element. That way, there are 8 valence electrons in this new bond, or a full outer energy level!
Ground state means 1s which can hold 2 electrons. l for 1s is = 0 ml = 0 (given) possible values of m = 0 so it can hold maximum of 2 electrons. One spin up and other spin down.