Let $X$ be a random variable that represents the number of trials of a given experiment. The outcome of a single trial is a Bernoulli random variable, with probability of success $p$, and trials are independent.
The maximum number of trials is $n$, but if there are $k<n$ consecutive successes the experiment ends.
What is the probability distribution?