I struggled trying to understand the given solution

How does the 5(k-1)+1 and 5(k+1)-1 come about? I can’t figure it out.

Also, I tried this method where I multiple the ratio 2:5 by 2,3,4 and 5. I quickly noticed that the difference in total no of employees peak at x3 ie the subsequent difference between total no of employee between x3, x4 and x5 stay constant. Hence I ‘deduced’ that p and q ought to be 6 managers and 15 employees instead, and my answer is 8 which is obviously wrong…