A Random Walk on $\mathbb{Z}$ starts at $0$. $X_i = 1$ with probability $p$ and $X_i = -1$ with probability $1-p$. I'm looking for the distribution that $\sum_{i=1}^n X_i = S_n = a$, but such that $\forall m < n, S_m < a$. In other words, I'm looking for the distribution of the $\textbf{FIRST}$ time the random walk hits $a$ after $n$ steps.
If we let $n_1$ be the steps to the right, and $n_2$ be the steps to the left, we want $n_1 - n_2 = a$ and $n_1 + n_2 = n$, BUT with the additional requirement that $S_m < a \space \forall m<n$. How do I incorporate this requirement to see the distribution and calculate $\mathbb{P}(S_n = a)$?