The electronic structure of first-row negative ions and transition metal atoms