There are $K$ checkout counters in the mall, and there are $N$ shoppers in the queue waiting for a checkout counter. Initially all counters are empty. Whenever a counter is empty, the next shopper in queue will go ahead and use it.
Every shopper will take a random amount of time to finish their checkout process. The amount of time taken is a random integer between $1$ and $M$. The amount of time taken by different shoppers is independent of each other. The first $K$ shoppers in the queue will have to wait for $0$ time, since there are $K$ empty counters initially.
Calculate the expected amount of time each shopper in the queue will have to wait.
So far, I've been able to derive a formula using the three parameters for the random variable of the $K+1$th shopper (the minimum of $K$ discrete uniform random variables $U(1,M)$), but I can't think of any way how to generalise this for all customers.
This question is taken from hacker-rank and I've spent a significant amount of time trying to solve it successfully, and although my solution works for some cases, I am very much more interested in the general solution. I am not interested in the code for this, but rather an expression for each random variable $X_i$ for $i \in [1..N]$ i.e. the distribution of time each customer has to wait.