31. (MON 2) An urn contains balls of $k$ different colors; there are $n_{i}$ balls of the $i$ th color. Balls are drawn at random from the urn, one by one, without replacement. Find the smallest number of draws necessary for getting $m$ balls of the same color.
31. Suppose that $n_{1} \leq n_{2} \leq \cdots \leq n_{k}$. If $n_{k}<m$, there is no solution. Otherwise, the solution is $1+(m-1)(k-s+1)+\sum_{i<s} n_{i}$, where $s$ is the smallest $i$ for which $m \leq n_{i}$ holds.