Mark has 5 friends.
In order to find this you need to set up a system of equations. Let x equal the amount of cookies Mark has. Let y be the amount of friends that Mark has.
The first equation will show the first scenario.
x - 8y = 6
The second equation will show the second scenario.
x - 9y =1
Now we can solve the system of equations through addition. Multiply the second equation by -1 and then add them together (the x values will cancel out).
x - 8y = 6
-x + 9y = -1
---------------
y = 5
Since y = number of friends, we know he has 5 friends.