The capability of an atom to gain or lose it valence electrons in order to complete it's valence shell ( last shell) is known as valency.
ATOMIC NUMBER- 11
ELECTRONIC CONFIGURATION- K-2,L-8,M-1
Atom of every element wants to have eight electrons in it's valence shell. As you can see above sodium has one electron in it's valence shell. In order to get a completely filled outermost shell it has to lose this one electron. So, it will have a valency of 1.
ATOMIC NUMBER- 16
ELECTRONIC CONFIGURATION- K-2, L-8, M-6
As, sulphur has six electrons in it's valence shell it has to gain 2 more electrons to have a full valence shell and it will have a valency of 2.