What code? NFHS or NCAA?
In NCAA it's a foul but not illegal touching nor illegal participation
Since this is not the NFHS forum, I will pile on here. As Skybolt says, the ONLY foul is for the illegal return into the field of play
after being OB voluntarily. Going, or being, out of bounds is not a foul (voluntarily or involuntarily). Once such a player returns inbounds, he is no different than any other player of Team A. His having been out of bounds has no bearing, whatsoever, on his eligibility/ineligibility to touch the kicked ball (not eligible until the ball is touched by B). And his ability to legally block (as defined) opponents is the same as any other A player. (Yes, his eligibility to touch a legal forward pass is affected - he is not eligible for that, until the ball is touched by B or an official). (There is no such animal as 'illegal participation' in NCAA rules).
So, for NCAA, in the down offered, the recovery of the ball by A8 is an illegal recovery, which allows Team B to invoke the illegal recovery privilege, and take the ball at the spot of the illegal recovery (the dead ball belongs to Team B at that spot). The return inbounds by A8 is a foul for an illegal return, which carries a 5-yard penalty, which may be enforced either at the previous spot, with Team A retaining the ball and the down repeated, or it may be enforced at the spot where the dead ball belongs to B.