I know this has been asked before, but most existing answers have been in the form of summations instead of framing this as a stars and bars problem as taught in class.
We were given that the answer is ($n-1$ choose $k-1$), as in $n-k$ stars and $k-1$ bars, but I'm having trouble seeing why the former is the case.
[Edit] This is what I have tried so far: I know that we can make each of the positive numbers into k bins, thus there will be k-1 bars when framing it into a stars and bars problem.
However, when it comes to the n-k stars, the only explanation I can think of is subtracting k (the value we first chose) from n to find the remaining value we need to account for, but I don't think this makes sense. Any help on figuring out why it is n-k stars would be appreciated!
Alternative perspective:
For the general theory of applying Stars and Bars, with upper boundaries on the variables, see this answer.
Here, I am going to borrow two concepts from that article:
[1]
In general, the number of solutions to
$y_1 + y_2 + \cdots + y_k = n ~: ~y_i \in \Bbb{Z_{\geq 0}}~$ is $$\binom{n + [k-1]}{k-1}.$$
The above formula, which is directly proven in this article, provides an easy to apply basis for attacking your question.
[2]
Using one of the methods in the article referenced in my first link, the standard approach is :
You wish to enumerate the number of solutions to :
$x_1 + x_2 + \cdots + x_k = n ~: ~x_i = \Bbb{Z^+}.$
Let $y_i = x_i - 1 ~: ~i \in \{1,2,\cdots,k\}.$
Therefore, $y_i \in \Bbb{Z_{\geq 0}} ~: ~i \in \{1,2,\cdots,k\}.$
Note that there is a bijection between the set of solutions that you are trying to enumerate and the set of solutions to
$y_1 + y_2 + \cdots + y_k = (n-k).$
Therefore, the desired enumeration must be
$$\binom{[n-k] + [k-1]}{k-1} = \binom{n-1}{k-1}.$$