Normally, a foul by Team A behind the LOS is enforced from the previous spot. According to Rule 10-4-4e, though, the enforcement spot is the spot of the foul when Team A commits any foul in his end zone for which the penalty is accepted. In the current Reddings NFHS Study Guide (p. 124), there is a reminder that "it is the location of the foul that matters, not from where the penalty by the offense would normally be enforced." So, I'd say the options for Team B are to decline the penalty, making it 2nd & 12 at the 2-yard line, or accept the penalty, which results in a safety.