Dear Student,
Element A has electronic configuration of 2,8,7 so it requires one electron to achieve a stable octet so it will gain one electron and form A- .
Element B has electronic configuration 2,8,1 it will lose one valence electron to achieve stable octet and form B+.
The element will lose the one electron to A and form an ionic bond . The chemical formula of compound will be BA.
A is a non- metal because nonmetals are electronegative in nature and gain electron to form anions.
The compound is NaCl.
Regards!