When the try is unsuccessful, Team A can accept the penalty and repeat the try, or they can decline the penalty and end the try. If the try is repeated, then, by rule, the dead-ball UNS by B is also penalized on the repeat of the try - it may not be enforced at the succeeding kickoff, or succeeding spot in an extra period.
However, if Team A declines the live-ball foul, the try is over, and then the dead-ball UNS by B may be enforced at the succeeding kickoff, or at the succeeding spot in extra periods. Depending on time and score, Team A just might choose this option.
Several rule references: 8-3-3-b-1, 8-3-3-d-2, 8-3-5. And AR 8-3-3-I.