Marbles, explaination doubt

i am not getting , why m is put = to n-k ???

I am attaching more of mathematical reasoning, which would be more intuitive and easy to understand ig.
If you are still not getting it, feel free to ask.
You can watch some videos on star and bars method to get the hang of it. Deduction of the formula used (star and bars) is covered in the videos, and I have used the same.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.