I am trying to solve a particular problem involving multiple conditions on a random variable. We have $X_1, X_2....$ such that $X|K = k_i$ is a negative binomial with number of success given by $max(k-k_i,0)$ with success probability q where k is fixed. Random variable K is conditioned on Y and $Y$ is $ Bin(n,p) $ such that $(K|Y=y)$ is $Bin(Y, 1-\delta)$ From what I have read in the literature, K should be a Binomial Random Variable $Bin(n,pq)$
I have tried deriving the CDF of X using the law of total probability. But how should I account for that random number of success? Could somebody please guide me through the algebra or provide me with a relevant link.