# Counting permutations with k maximums

I’m trying to solve a problem that counts the number of permutations of N elements with K maximums, where a maximum is defined as an element in the permutation that is greater than all of the elements to its left. For simplicity let’s consider the elements 1..n{1..n}.

As an example, for N=3 and K=2, the number is 3

1 3 2, 2 1 3
and
2 3 1

Here’s a recurrence for this that I have found: