Let’s see if we can’t wrap this up.
The assumption is that the facemask foul by A took place behind the spot where the ball became dead when the runner went out of bounds.
First, we address the live ball foul. Go back to the spot of the facemask foul, and go back 15 yds. assuming it was a personal foul and not a 5 yd. facemask.
Second, now that we’ve enforced the penalty for the live ball foul, we look at the chains. If the ball is beyond the line to gain, it’s a 1st down. If the ball is not beyond the LTG, then the down counts.
Finally, we address the dead ball foul. It’s 15 yds. against Team B, enforced from the spot after the live ball foul’s enforcement. If that takes the ball beyond the LTG, then it’s a 1st & 10 for Team A there. If it’s not beyond the LTG, play the next down.
Regardless, the clock will start on the snap.