A Gambler starts with $M\geq 0$ dollars in bank, starting at time $t=0$, he spends the $k^{\mathrm {th}}$ dollar at time $\sum_{i=1}^{k}A_i$ and he earns the $k^{\mathrm {th}}$ dollar at time $\sum_{i=1}^{k}J_i$, where independent sets of random variables $\{A_1, A_2, \ldots \}$ and $\{J_1, J_2,\ldots\}$ are samples of probability distribution function $f_A(x)$ and $f_J(x)$, respectively. Find $\mathbb{P}(L|A_1,\ldots,A_{L})$, the probability that the amount in his account becomes zero when he spends the $L^{\mathrm{th}}$ dollar, given the random variables $\{A_1, A_2, \ldots, A_{L} \}$.
I think since $L$ depends on $\{A_1, A_2, \ldots, A_{L} \}$ and $\{J_1, J_2, \ldots, J_{L-M} \}$, we first should find $\mathbb{P}(L|A_1,\ldots,A_{L}, J_1,\ldots,J_{L-M})$, then integrate it with respect to variables $J_1,\ldots,J_{L-M}$. Seems complicated.
Let us write $L=M+N$.If $ N<0$ the probability of depleting the account by spending $L$ dollars is zero. So let us consider the case $N\ge0$. Let us also write $$T_k =\sum_1^k A_i, \ \ S_k = \sum_1^k J_i.$$ Then if we think of how the process evolves in time, we need to always have a positive balance until time $T_L,$ and at that time the balance in the bank account should be $1$. This can be encoded in the following $N+1$ conditions: $$T_{M+1} > S_{1}, \ldots , T_{M+ N} \ge S_N, \text{ and } S_{N+1} \ge T_{M+ N}.$$ Now we can compute the conditional probability by integrating. As far as I can see though, there is no particularly nice closed for for this integral: $$\int_{-\infty}^{T_{M+1}} dx_1 \ldots \int_{-\infty}^{T_{M+N}} dx_N \int_{T_{M+N}}^{\infty} dx_{N+1} f_J (x_1) \cdots f_J(x_N - \sum^{N-1}_1 x_i) f_J(x_{N+1} - \sum^{N}_1x_i)$$