Short answer: Illegal touching by A; B’s ball a the spot where A first touched the ball.
Full explanation:
When a scrimmage kick has crossed the neutral zone, no player of Team A may touch the ball before it is touched by Team B. Such touching by A is illegal touching, which gives Team B the privilege of taking the ball at any spot of illegal touching.
Also, when a player of Team A possesses the ball that is loose from a scrimmage kick that has crossed the neutral zone (regardless of touching by either team), the ball becomes dead at that spot of possession.
So, in this case, the ball becomes dead when possessed by A at the B-5, and A’s touching of the ball is illegal, so B gets the ball at the B-5.
The fact that the A recoverer carried the ball across B’s goal line is moot and irrelevant, since the ball was already dead.
Robert