If is to replace a player before the start of the game, the sub is the first of the subs that is not a GK.
If it is a auto sub during the match, If you have that all set, injured DCs are replaced for defenders, injured MCs for midfielders, injured STs for forwards, GK for GK, Injured DR/L MR./L or AMR/L are replaced for wingers. DMC and DMC i am not sure, but maybe for midfielders.