Help with Combination Guys need help to solve this one..
How will we arrange  Red balls in '$N$' places , so that if you choose any '$M$' consecutive places, there should be at least '$K$' Red balls among this '$M$' chosen places.And we should use minimum number of Red balls.
Now, If $N = 6$ and $M = 3$ and $K = 2$ then, one combination is like '$1\,\; R\,\; R\,\; 1\; R\; R\; 1$' Here if we choose any $3$ consecutive places, there will be $2$ Red Balls. So like that how many ways we can do it.. 
There could be a larger numbers also.
Please help.. 
 A: Completely revised to answer the general question:
Assume first that $n=3m$, so that we may segment the string into $m$ blocks of three balls. Each block must be of one of the forms RRW, RWR, and WRR, and a string of $m$ RRW blocks is certainly acceptable, so there must be $2m$ red and $m$ white balls. 
Let $s_m$ be the number of acceptable strings of $3m$ balls. Suppose that I have such a string. If it ends with a WRR block, I can append any of the three kinds of block to get an acceptable string of length $3(m+1)$. If it ends with an RWR block, I can append either an RWR or an RRW block, but not a WRR block. And if it ends with an RRW block, I can only append another RRW block. To turn it around, a WRR block can only follow another WRR block; an RWR block can follow a WRR block or another RWR block; and an RRW block can follow anything.
Let $r_m$ be the number of acceptable strings of length $3m$ that end with an RRW block, $c_m$ the number that end with an RWR block, and $\ell_m$ the number that end with a WRR block. Then from the last paragraph we see that
$$\begin{align*}
s_m&=r_m+c_m+\ell_m\;,\\
r_m&=s_{m-1}\;,\\
c_m&=c_{m-1}+\ell_{m-1}\;,\text{ and}\\
\ell_m&=\ell_{m-1}\;.
\end{align*}\tag{1}$$
Clearly $r_1=c_1=\ell_1=1$, so $\ell_m=1$ for all $m\ge 1$, and $(1)$ reduces to
$$\begin{align*}
s_m&=r_m+c_m+1\;,\\
r_m&=s_{m-1}\;,\text{ and}\\
c_m&=c_{m-1}+1\;.\\
\end{align*}\tag{2}$$
From the last line of $(2)$ it’s clear that $c_m=m$ for all $m\ge 1$, so $$s_m=s_{m-1}+m+1\;.\tag{3}$$ If we set $s_0=1$ and $r_0=c_0=0$, the recurrences are all valid for $m\ge 1$, and it’s not hard to verify that 
$$s_m=\sum_{k=1}^{m+1}=\frac12(m+1)(m+2)=\binom{m+2}2\;.$$
This completely answers the question when $n$ is a multiple of $3$.
Now suppose that $n=3m+1$. There is an acceptable string of length $3m$ ending in WRR, namely, a string of $m$ WRR blocks; we can append a white ball to this string, so there is an acceptable string of length $n$ with just $2m$ red balls. However, this is the only such string, since, as we saw before, a WRR block must follow another WRR block, and so on back to the beginning of the string. Thus, there is only one acceptable string of length $n=3m+1$ that uses the minimum possible number of red balls: $(\text{WRR})^m\text{W}$.
Finally, suppose that $n=3m+2$. Clearly at least one of the last two balls must be red, and one suffices, since we can append a red ball to the string $(\text{WRR})^m\text{W}$, so the minimum possible number of red balls in this case is $2m+1$. We can append WR to an acceptable string of length $3m$ if and only if the string is $(\text{WRR})^m$; that accounts for one acceptable string of length $n$. We can append RW to any acceptable string of length $3m$ that ends in RWR or WRR. There is just one of the latter, and there are $c_m=m$ of the former, so this case accounts for another $m+1$ acceptable strings of length $n$. Thus, there are $m+2$ acceptable strings of length $n=3m+2$.
