It is the number in the main group element. It is variable for transition elements. You can count the groups from the left without omitting transition elements to get the number of valences electrons.
The electron configuration is the sum of the s electrons and the p electrons of main group elements. It is also variable for the transition elements. Silver and many other elements have different oxidation states.