Problem
Suppose that we are given a multiset of integers $A$ with the property that all elements in $A$ are between $a$ and $b$ (inclusive) where $a < b$. It is guaranteed that for all $i$ in $[a,b]$ that there is at least one integer in $A$ with a value of $i$ (i.e. if $a=2$ and $b=5$ then it is guaranteed that a $2$, $3$, $4$, and $5$ will appear at least once in $A$).
How many ways can we select $n$ integers from $A$ such that the sum of these integers is $k$?
Attempt
Forgetting the restriction that there are a limited number of integers from which we can take, then we are looking for the numbers of solutions to $x_1+x_2+\cdots+x_{n-1}+x_n$ where $a \leq x_i \leq b$ for all $i$ in $[1, n]$. Fortunately, I know how to solve problems like these using a generation function: $$\left(x^a+x^{a+1}+\cdots+x^{b-1}+x^b\right)^n.$$ The coefficient of the $k$-th degree term in the generating function tells us the number of ways of making a sum of $k$.
However, the problem is that we can't use the generating function since the number of integers in the interval is limited. For example, if $A=\{3,4,5\}$ where $a=3$ and $b=5$ then we can make a sum of $12$ with $3$ integers in exactly three ways: $3+4+5=12$ or any permutation of that; however, according to the generation function, we can make a sum of $12$ in $7$ ways since we can use multiple of the same integer---though, that is obviously not the case.
First of all we have better to reduce the parametrs in play by reconducting the problem to the elements in $\{ 0,b-a \}$ $$ \left\{ \matrix{ a \le x_{\,j} \le b \hfill \cr x_{\,1} + x_{\,2} + \cdots + x_{\,n} = k \hfill \cr} \right.\quad \Rightarrow \quad \left\{ \matrix{ 0 \le y_{\,j} \le b - a = r \hfill \cr y_{\,1} + y_{\,2} + \cdots + y_{\,n} = k - na = s \hfill \cr} \right. $$
Then
a) if repetitions were allowed in whichever number (from $0$ to $n$), so that we can write $$ \left\{ \matrix{ 0 \le y_{\,1} ,y_{\,2} , \cdots ,y_{\,n} \le r \hfill \cr y_{\,1} + y_{\,2} + \cdots + y_{\,n} = s \hfill \cr} \right. $$ then the number of solutions to that would be encoded by the ogf you correctly indicated, and that can be computed by the finite sum $$ N_b (s,r,m)\quad \left| {\;0 \leqslant \text{integers }s,m,r} \right.\quad = \sum\limits_{\left( {0\, \leqslant } \right)\,\,k\,\,\left( { \leqslant \,\frac{s}{r+1}\, \leqslant \,m} \right)} {\left( { - 1} \right)^k \binom{m}{k} \binom { s + m - 1 - k\left( {r + 1} \right) } { s - k\left( {r + 1} \right)}\ } $$ as explained in this post.
Instead , with
b) no repetitions, we are to find the number of solutions to $$ \left\{ \matrix{ y_{\,j} \ne y_{\,k} \quad \left| {\;j \ne k} \right. \hfill \cr 0 \le y_{\,1} ,y_{\,2} , \cdots ,y_{\,n} \le r \hfill \cr y_{\,1} + y_{\,2} + \cdots + y_{\,n} = s \hfill \cr} \right. $$ and since the parts are all different, these will be $n!$ times the number of solutions to $$ \left\{ \matrix{ 0 \le y_{\,1} < y_{\,2} < \cdots < y_{\,n} \le r \hfill \cr y_{\,1} + y_{\,2} + \cdots + y_{\,n} = s \hfill \cr} \right.\quad \Leftrightarrow \quad \left\{ \matrix{ 1 \le z_{\,1} < z_{\,2} < \cdots < z_{\,n} \le r + 1 \hfill \cr z_{\,1} + z_{\,2} + \cdots + z_{\,n} = s + n \hfill \cr} \right.\quad \Leftrightarrow \quad \left\{ \matrix{ 1 \le v_{\,1} \le v_{\,2} \le \cdots \le v_{\,n} \le r + 2 - n \hfill \cr v_{\,1} + v_{\,2} + \cdots + v_{\,n} = s - {{n\left( {n - 3} \right)} \over 2} \hfill \cr} \right. $$ where the second derives from the first by adding $1$ to all parts, and the third from the second by subtracting $0$ from $z_1$, $1$ from $z_2$, and so on till $n-1$ from $z_n$.
Therefore that is the number of partitions of $s+n$ into $n$ distinct parts, with the greatest part not exceeding $r+1$,
or also the number of partitions of $s- n*(n-3)/2$ into $n$ parts not greater than $r+2-n$.
For solutions to exist we shall have in all cases that $$ \left\{ \matrix{ n \le r + 1 \hfill \cr \left( \matrix{ n \cr 2 \cr} \right) \le s \le {{n(2r - n + 1)} \over 2} \hfill \cr} \right. $$ and it is profitable to include the case $n=0, s=0$ for which we take the solution to be $1$: the empty set.
Now, the development of this polynomial $$ f(x,r) = \left( {1 + x} \right)\left( {1 + x^{\,2} } \right) \cdots \left( {1 + x^{\,r + 1} } \right) = \cdots + x^{0 \cdot \left( 1 \right) + 1 \cdot \left( 2 \right) + 1 \cdot \left( 3 \right) + \cdots + 0\left( {r + 1} \right)} + \cdots $$ turns out in the sum of powers of $x$, where the exponent add or not each one of the elements of $\{1, \cdots, r+1\}$, and thus $f(x,r)$ is the ogf of the above system in $z$, but with an unspecified number of parts.
We can find the ogf for the system in $v$ as well, but it will also miss a parameter and it is more complicated to handle.
The only way is that from the $f(x,r)$ above we take only $n$ terms in $x$ and sums over every possible $n$-subset of $\{ 1, \cdots, r+1 \}$. $$ \eqalign{ & g(x,r,n) = \sum\limits_{0\, \le \,s} {N(s,r,n)\,x^{\,s + n} } = \cr & = \sum\limits_{\left\{ {k_{\,1} ,\,k_{\,2} ,\, \ldots ,\,k_{\,n} } \right\}\, \subset \,\left\{ {1,\,2,\, \ldots ,r + 1} \right\}} {x^{\,k_{\,1} } x^{\,k_{\,2} } \cdots x^{\,k_{\,n} } } \cr} $$ but since it requires the generations of the subsets it is of no practical advantage over counting those for which the sum of the elements is the required one.
Yet, it helps to easily define a recurrence relation $$ \eqalign{ & g(x,r,n) = \sum\limits_{0\, \le \,s} {N(s,r,n)\,x^{\,s + n} } = \cr & = \sum\limits_{n\, \le \,k_{\,n} \, \le \,r + 1} {x^{\,k_{\,n} } \sum\limits_{\left\{ {k_{\,1} ,\,k_{\,2} ,\, \ldots ,\,k_{\,n - 1} } \right\}\, \subset \,\left\{ {1,\,2,\, \ldots ,k_{\,n} - 1} \right\}} {x^{\,k_{\,1} } x^{\,k_{\,2} } \cdots x^{\,k_{\,n - 1} } } } = \cr & = \sum\limits_{n\, \le \,k\, \le \,r + 1} {x^{\,k} g(x,k - 2,n - 1)} + \left[ {n = 0} \right] = \cr & = \left[ {n = 0} \right] + \sum\limits_{n\, \le \,k\, \le \,r + 1} {x^{\,k} \sum\limits_{0\, \le \,s} {N(s,k - 2,n - 1)\,x^{\,s + n - 1} } } = \cr & = \left[ {n = 0} \right] + \sum\limits_{0\, \le \,s} {\left( {\sum\limits_{n\, \le \,k\, \le \,r + 1} {N(s,k - 2,n - 1)\,x^{\,s + n - 1 + k} } } \right)} = \cr & = \left[ {n = 0} \right] + \sum\limits_{0\, \le \,s} {\left( {\sum\limits_{n\, \le \,k\, \le \,r + 1} {N(s - k + 1,k - 2,n - 1)\,} } \right)x^{\,s + n} } \cr} $$ which leads to: $$ \bbox[lightyellow] { \eqalign{ & N(s,r,n) = \left[ {n = 0} \right]\left[ {s = 0} \right] + \sum\limits_{n\, \le \,k\, \le \,r + 1} {N(s - k + 1,k - 2,n - 1)\,} = \cr & = \left[ {n = 0} \right]\left[ {s = 0} \right] + \sum\limits_{n - 2\, \le \,k\, \le \,r - 1} {N(s - k - 1,k,n - 1)\,} \cr} }$$ where the condition in square brackets $[P]$ denotes the Iverson bracket
Also, taking out the bias and putting $$ s \to s + \left( \matrix{ n \cr 2 \cr} \right)\quad r \to r + \left( {n - 1} \right) $$ the recursion becomes more neat $$ \bbox[lightyellow] { N_{\,s\,c} (s,r,n) = \left[ {n = 0} \right]\left[ {s = 0} \right] + \sum\limits_{0\, \le \,k\, \le \,r} {N_{\,s\,c} (s - k,k,n - 1)\,} }$$ with the understanding that the parametrs of $N_{\,s\,c}$ are the unbiased ones of those appearing in $N$ above.
Finally, when
c) repetitions are allowed and limited then we are in between case a) and b).
I am not aware of any "easy" way to compute the number of solutions in this case, other than the clumsy o.g.f. $$ \eqalign{ & H(x,r,n) = \sum\limits_{0\, \le \,s} {N_{\,rep} (s,r,n)\,x^{\,s} } = \cr & = \sum\limits_{\left( {k_{\,1} ,\,k_{\,2} ,\, \ldots ,\,k_{\,n} } \right)\,\; \leftarrow \,\,{\rm multiset}\,\left\{ {1,\,2,\, \ldots ,r + 1} \right\}} {x^{\,k_{\,1} } x^{\,k_{\,2} } \cdots x^{\,k_{\,n} } } \cr} $$ where the $n$-tuples $\left( {k_{\,1} ,\,k_{\,2} ,\, \ldots ,\,k_{\,n} } \right)$ are constructed from the multiset respecting the multiplicities assigned.