The aufbau principle is introduced:

1) Pauli exclusion principle:  No two electrons may have the same set of quantum numbers (in an atom).

An atom with all the electrons in the lowest allowable energy level is in the "ground state".  To determine the lowest state, start with these rules:

2)  Given the other quantum numbers are identical, the lower n is the lower the energy.

3)  Given a choice of ms initially, +1/2 and -1/2 are equal.

4)  Given the other quantum numbers are identical, the lower l is the lower the energy.

5)  Initially, before any opportunity to select ml , all are of equal energy.

The quantum numbers to build up to boron are determined:

atom
electrons
n
l
ml
ms
H
1
1
0
0
+1/2*
He
2
1
0
0
-1/2
Li
3
2
0
0
+1/2*
Be
4
2
0
0
-1/2
B
5
2
1
1*
+1/2*

*arbitrary at this point.