For this case, the first thing we must do is define variables:
x: students of group 1
y: students of group 2
We now write the system of equations that models the problem:

Solving the system by substitution we have:



Then, the value of y is given by:

Answer:
8 students of group 1
20 students of group 2