After the collision, the momentum didn't change, so the total momentum in x and y are the same as the initial.
The x component was calculated by subtracting the initial momentum (total) minus the momentum of the first ball after the collision
In the y component, as at the beginning, the total momentum was 0 in this axis, the sum of both the first and struck ball has to be the same in opposite directions. In other words, both have the same magnitude but in opposite directions
This is for both balls after the collision, but one goes in a positive and the other in a negative direction.