Unless there was more than 2:40 remaining, I would penalize B 15 yards, and give A a first down, DQ the guilty player(s), set the play clock to 40, and start both clocks on the RFP signal. Team A would only have to take a knee three times. Team B would would probably not want a bunch of their players DQd, so I think this would let the game end with its full duration.
If more than 2:40 to play, and if I didn't think Team B was going to stop this action, I'd forfeit the game.
Robert