2 Corrected case where $n-aq$ is negative.

Choices of $k$ out of $n$ correspond to ordered $k+1$-tuples of nonnegative numbers which add up to $n-k$ by counting the dots between the Xs.

The number of such $k+1$-tuples so that $a$ particular terms are at least $q$, with no restrictions on the others, is $n-aq \choose k$ [edit: when $n-aq \ge 0$, and $0$ otherwise], since subtracting $q$ from each of the terms we know are at least $q$ gives an unrestricted $k+1$-tuple adding to $n-aq$. So, the technique of inclusion-exclusion lets us count $f(n,k,q)$, the number of $k+1$-tuples with no term which is at least $q$:

$$f(n,k,q) = \sum_{a=0}^{k+1} (-1)^a {k+1\choose a}{n-aq\choose k}.$$

To count sequences where the maximum is exactly $q$, take $f(n,k,q+1)-f(n,k,q)$.

Edit: The above formula is incorrect because it includes the terms where $n-aq$ is negative. For these terms, replace $n-aq \choose k$ with $0$, or change the upper limit of the sum:

$$f(n,k,q) = \sum_{a=0}^{\lfloor n/q \rfloor} (-1)^a {k+1\choose a}{n-aq\choose k}.$$

1

Choices of $k$ out of $n$ correspond to ordered $k+1$-tuples of nonnegative numbers which add up to $n-k$ by counting the dots between the Xs.

The number of such $k+1$-tuples so that $a$ particular terms are at least $q$, with no restrictions on the others, is $n-aq \choose k$, since subtracting $q$ from each of the terms we know are at least $q$ gives an unrestricted $k+1$-tuple adding to $n-aq$. So, the technique of inclusion-exclusion lets us count $f(n,k,q)$, the number of $k+1$-tuples with no term which is at least $q$:

$$f(n,k,q) = \sum_{a=0}^{k+1} (-1)^a {k+1\choose a}{n-aq\choose k}.$$

To count sequences where the maximum is exactly $q$, take $f(n,k,q+1)-f(n,k,q)$.