Ways to select $m$ disjoint groups of consecutive elements from an $n$-element set

In your general case, there are $m$ beginnings and $m$ ends applied to the ordered set of elements

so for example if $m=2$ you get $.(.).(.).$ with the possibility of putting elements in the $.$s

but each $($ must be followed by an element so actually you have $.(x.).(x.).$ reducing the number of free elements to place down to $n-m$. If $m=2$, say $a,b,c$, and $n=3$ then you can position one free element in the $.$s and so, since there are $5$ .s, there are $5$ possibilities:

  • $a(b)(c)$ where the free element is $a$
  • $(ab)(c)$ where the free element is $b$
  • $(a)b(c)$ where the free element is $b$
  • $(a)(bc)$ where the free element is $c$
  • $(a)(b)c$ where the free element is $c$

So you need to choose the positions of the $2m$ things fixed by the beginnings and ends and the $n-m$ "free" elements, which you can do in ${2m+n-m \choose 2m} = {n+m \choose 2m}$ ways.

For your example of $n=7$ and $m=1$ you would get ${7+1\choose 2\times 1}={8 \choose 2}=28$ which is equal to your $\binom{7}{2} + \binom{7}{1}$.