Halogens (F, Cl, Br, I,) have 7 electrons in their outermost shells and hence their valency is -1.
The metals in s-block are group I elements and group II elements. Group I elements (H, Li, Na, K, Rb, Cs, Fr) have only one electron in their outermost shell and hence their valency is +1. Now by crossing valencies we get halides of the form MX.
It is due to this that group I metals form halides of the MX type.
Eg: NaCl, KCl
Gropu II elements (Be, Mg, Ca, Sr, Ba, Ra) have two electron in their outermost shell and hence their valency is +2.
When they combine with halogens they form halides of the MX2 type by crossing of valencies.