Here is a way to do it which doesn't look anything like a generalization of Hertzsprung's problem, but it is a generalization of the derangement count. A corollary of the exponential formula in permutation form is that if $c_1 < c_2 < \dots < c_i$ is a sequence of distinct positive integers then the asymptotic density of the number of permutations $a_n$ which do not have cycles of any length $c_i$ is
$$\lim_{n \to \infty} \frac{a_n}{n!} = \exp \left( - \sum_{j=1}^i \frac{1}{c_j} \right).$$
The sequence $c_j$ can even be infinite. So for any particular positive integer $k$ the problem reduces to finding a sequence $c_i$ satisfying
$$k = \sum_{j=1}^i \frac{1}{c_j}.$$
This is the Egyptian fraction problem and is always solvable (although sources seem to only prove this for positive rationals between $0$ and $1$ it is actually true for all positive rationals); for example
$$2 = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{6}$$
$$3 = \left( 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{6} \right) + \frac{1}{4} \left( 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{6} \right) + \left( \frac{1}{5} + \frac{1}{20} + \frac{1}{13} + \frac{1}{156} + \frac{1}{7} + \frac{1}{42} \right)$$
where that mess on the right was generated by starting with $\frac{1}{2}$ and then repeatedly applying the transformation
$$\frac{1}{n} = \frac{1}{n+1} + \frac{1}{n(n+1)}.$$
I also gave this problem to GPT-o3-mini who used a greedy algorithm to find
$$3 = 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \frac{1}{6} + \frac{1}{7} + \frac{1}{8} + \frac{1}{9} + \frac{1}{10} + \frac{1}{15} + \frac{1}{230} + \frac{1}{57960}.$$
To keep going from here you can add a new term $1$ and repeatedly apply the above identity whenever you get a denominator you've gotten already until your denominators are all distinct and new. Incidentally, this argument implies that the harmonic series diverges.
Admittedly this is a bit artificial although I think the $k = 2$ case is nice; we are counting permutations $g$ with no fixed points, $2$-cycles, $3$-cycles, or $6$-cycles, or equivalently permutations such that $g^6$ has no fixed points. If we use infinite sums we could instead go with
$$2 = 1 + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \dots $$
and then we'd be counting permutations with no cycles of length a power of $2$, or equivalently such that no power $g^{2^k}$ has a fixed point.