THE DECISION
The referee disallows the goal and awards an indirect free kick to Team A for offside. It does not matter whether the ball went from one Team B player to another Team B player (who was in an offside position) accidentally or deliberately.
Read official Law 11 ↗