Keys inside closed boxes, a question on probability

Assume, without loss of generality, that the $k$ random boxes contain keys numbered $1, 2, \ldots, k$. Accordingly, let $S(n,k)$ be the set of all permutations on $n$ elements such that each cycle has at least one of $1, 2, \ldots, k$. None of the permutations in $S(n+1,k)$ can have $n+1$ as a singleton cycle; thus each permutation in $S(n+1,k)$ must be obtained by inserting $n+1$ into a cycle in a permutation in $S(n,k)$. For each permutation in $S(n,k)$, there are $n$ ways to insert $n+1$ into one of its cycles; i.e., after each of the $n$ elements when the permutation is expressed as the product of disjoint cycles. Thus $S(n+1,k) = n S(n,k)$. Since $S(k,k) = k!$, we have $S(n,k) = k! k (k+1) \cdots (n-1) = k (n-1)!$, and so the probability that we can open all boxes is $$\frac{S(n,k)}{n!} = \frac{k}{n}.$$

(The recurrence $S(n+1,k) = n S(n,k)$ is like the recurrence for the Stirling numbers of the first kind $s(n+1,k) = n s(n,k) + s(n,k-1)$ without the second term, as the second term comes from permutations in which $n+1$ forms its own cycle.)