I'll be grateful for any ideas (or even solutions!) for the following task. I really want to know how to solve it.
Let $M$ be an arbitrary positive integer which represents the length of line constructed of $0$ and $1$ symbols. Let's call $M$-$N$-line a line of $M$ symbols in which there are exactly $N$ ($1 \leq N \leq M$) ones (all other elements are zeroes).
Also the number $L$ is given such that $1 \leq L \leq N$.
The task is to calculate the number of all $M$-$N$-lines in which there is a group of exactly $L$ consecutive ones and no group of more than $L$ consecutive ones.
For example if $M = 6$, $N = 4$, $L = 2$ then there are $6$ such $M$-$N$-lines:
Thanks in advance!