So we can arrange the $k$ choosen numbers in order, and therefore we are speaking of k-subsets from the set $\{1,\cdots , n\}$.
Let's
- put a $0$ in front of the subset (sequence);
- take the backward differences;
- neglecting the first ($=a_1$), consider the differences from the 2nd to $k$-term.
$$ \bbox[lightyellow] {
\eqalign{
& 0,a_{\,1} ,a_{\,2} , \cdots ,a_{\,k} \quad \left| {\;1 \le j \le a_{\,j} \le n} \right.\quad \Rightarrow \cr
& \;a_{\,1} ,a_{\,2} - a_{\,1} , \cdots ,a_{\,k} - a_{\,k - 1} = a_{\,1} ,d_{\,2} , \cdots ,d_{\,k} \quad \Rightarrow \cr
& \Rightarrow \quad d_{\,2} ,d_{\,3} , \cdots ,d_{\,k} \quad \left| \matrix{
\;2 \le j \hfill \cr
\;1 \le d_{\,j} = a_{\,j} - a_{\,j - 1} \le n - 1 \hfill \cr
\;1 \le \sum\limits_{2\, \le \,j\, \le \,k} {d_{\,j} } = q = a_{\,k} - a_{\,1} \le n - 1 \hfill \cr} \right. \cr}
} \tag{1}$$
Then we are looking for the
number of (standard) compositions of $0 \le q \le n-1$ into $1 \le k-1 \le n-1$ parts , each positive (and no greater than $n-1$) , that contain runs of contiguous ones no longer than $0 \le m-1$.
We will take for the moment the cumulative version "runs no longer than", and will later manage to get the version "runs with max length equal to".
For $k=1$, the above scheme does not apply, but for subsets with one element ,clearly, the number of contiguous elements is $1$,
and there are $n$ possible subsets.
For $2 \le k$, the same value of $q=a_{k}-a_{1}$ can be attained in $n-q$ ways, and the result shall be summed over $1 \le q \le n-1$.
It is known that the number of compositions of $q$ into $k$ parts is
$$ \bbox[lightyellow] {
N_{\,s\,c} (q,k) = \left[ {1 \le q} \right]\left( \matrix{
q - 1 \cr
k - 1 \cr} \right)
} \tag{2.a}$$
where $[P]$ denotes the Iverson bracket.
We can part this quantity according to the number of ones that it contains, denoted by $0\le s \le k$, as
$$ \bbox[lightyellow] {
\eqalign{
& N_{\,s\,cs} (q,k,s) = \left[ {k = q} \right]\left[ {k = s} \right] + \left[ {k + 1 \le q} \right]\left( \matrix{
q - k - 1 \cr
k - s - 1 \cr} \right)\left( \matrix{
k \cr
s \cr} \right) = \cr
& = \left( {\left[ {k = q} \right]\left[ {k = s} \right] + \left[ {k + 1 \le q} \right]\left( \matrix{
q - k - 1 \cr
k - s - 1 \cr} \right)} \right)\left( \matrix{
k \cr
s \cr} \right) \cr}
} \tag{2.b}$$
where the second term (${{k} \choose {s}}$) corresponds to the number of binary string $(1,\cdots,X,\cdots)$
obtained by replacing with $X$ the parts greater than one, and the first factor to the number of ways to compose the $X$s.
Coming to the binary string, clearly we can change the $X$ with a $0$, then
the number of binary strings of a given length , number of ones, and max length of runs of ones
is extensively treated in this other post.
From there we have that the
Number of binary strings, with $s$ ones , $m$ zeros and runs of ones which are not longer than $r$
is given by
$$ \bbox[lightyellow] {
N_b (s,r,m + 1)\quad \left| {\;0 \le {\rm integers }\,s,m,r} \right.\quad = \sum\limits_{\left( {0\, \le } \right)\,\,j\,\,\left( { \le \,{s \over r}\, \le \,m + 1} \right)} {\left( { - 1} \right)^j \left( \matrix{
m + 1 \cr
j \cr} \right)\left( \matrix{
s + m - j\left( {r + 1} \right) \cr
s - j\left( {r + 1} \right) \cr} \right)}
}\tag {3.a}$$
Translating that into into our case, the number of
binary strings with length $k$ and $s$ ones and runs of ones no longer than $m$ is
$$ \bbox[lightyellow] {
\eqalign{
& N_b (s,m,k + 1 - s)\quad \left| {\;0 \le {\rm integers }\, s,m,k - s} \right.\quad = \cr
& = \left[ {\;0 \le s} \right]\left[ {\;0 \le m} \right]\left[ {\;s \le k} \right]\sum\limits_{\left( {0\, \le } \right)\,\,j\,\,\left( { \le \,\,k - s + 1} \right)} {\left( { - 1} \right)^j \left( \matrix{
k + 1 - s \cr
j \cr} \right)\left( \matrix{
k - j\left( {m + 1} \right) \cr
s - j\left( {m + 1} \right) \cr} \right)} \cr}
} \tag{3.b}$$
Going back through the steps above, the
Number of composition of $q$, with length $k$ , number of ones $s$ and runs of ones no longer than $m$
will be the above multiplied by the first factor in (2.b)
$$ \bbox[lightyellow] {
\eqalign{
& N_{\,c\,q\,s} = (q,k,s,m)\quad \left| {\;{\rm integers }q,s,m,k} \right.\quad = \cr
& = \left( {\left[ {k = q} \right]\left[ {k = s} \right] + \left[ {k + 1 \le q} \right]\left( \matrix{
q - k - 1 \cr
k - s - 1 \cr} \right)} \right)N_b (s,m,k - s + 1) = \cr
& = \left( {\left[ {k = q} \right]\left[ {k = s} \right] + \left[ {k + 1 \le q} \right]\left( \matrix{
q - k - 1 \cr
k - s - 1 \cr} \right)} \right)\; \cdot \cr
& \cdot \sum\limits_{\left( {0\, \le } \right)\,\,j\,\,\left( { \le \,\,k - s + 1} \right)} {\left( { - 1} \right)^j \left( \matrix{
k + 1 - s \cr
j \cr} \right)\left( \matrix{
k - j\left( {m + 1} \right) \cr
s - j\left( {m + 1} \right) \cr} \right)} \cr}
} \tag{4}$$
Therefore, the
number of k-subsets from the set $\{1,\cdots , n\}$ having no more than $m$ contiguous characters
is
$$ \bbox[lightyellow] {
\eqalign{
& N_{c\,u\,m} (n,k,m) = \left[ {1 = k} \right]\left[ {1 \le m} \right]n + \cr
& + \left[ {2 \le k} \right]\sum\limits_{0\, \le \,q\, \le \,n - 1} {\sum\limits_{0\, \le \,s\, \le \,k} {\left( {n - q} \right)N_{\,c\,q\,s} (q,k - 1,s,m - 1)} } \cr}
} \tag{5.a}$$
Finally, the number of k-subsets with one or more run of contiguous elements
of length $m$, and none longer will clearly be
$$ \bbox[lightyellow] {
N_{c\,u\,m} (n,k,m)-N_{c\,u\,m} (n,k,m-1)
} \tag{5.b}$$