See Example 8d of Section 4.8 of "A 1st course in Probability" by Sheldon Ross.
Here it is:
If independent trials, each resulting in a success with probability $p$, are performed, what is the probability of $r$ successes occurring before $m$ failures?
Solution. The solution will be arrived at by noting that $r$ successes will occur before $m$ failures if and only if the $r$th success occurs no later than the $(r + m − 1)$th trial. This follows because if the $r$th success occurs before or at the $(r + m − 1)$th trial, then it must have occurred before the $m$th failure, and conversely. Hence, from Equation (8.2) (that's the explicit form of the Negative Binomial distribution), the desired probability is $$ \sum_{n=r}^{r+m-1} \binom{n-1}{r-1}p^r(1-p)^{n-r}. $$