How do bonds form between metals and nonmetals?