5x+4=y 1 formula
6*(x- 1)+2=y 6x-4=y 2 formula
From formula 2-1, we get: x-8=0 x=8.
Y=5*8+4=44。
So there are 8 students and 44 pencils.