I have two bags: one filled with red marbles, and one filled with blue marbles. I would like to fill a bin with only $k$ red marbles and no blue marbles. However, I can only sample (with replacement) from the bag of red marbles with probability $p$ and from the bag of blue marbles with probability $(1-p)$. Thus, the expected fraction of red marbles in the bin after $N$ additions is $pN$.

However, at any point, I can stop and select marbles from the bin (strictly with uniform probability, regardless of their color) to toss out.

What is an optimal strategy for minimizing the number of marbles rejected / removed from the bin until I reach the state where the bin is filled with only $k$ red marbles (after the aforementioned random walk like process)? What probability distribution should I expect for the number of total number of marble additions and removals from the bin provided some $k$ and $p$?

Update - How might it matter if one chooses to enter the pruning phase when spotting a single blue marble vs. some number of blue marbles $k$? Intuitively, I would expect it wouldn't, but is this provable?