An urn contains balls of $k$ different colors; there are $n_i$ balls of $i-th$ color. Balls are selected at random from the urn, one by one, without replacement, until among the selected balls $m$ balls of the same color appear. Find the greatest number of selections.