Code Golf
Mathgeek
Now to start thinking laterally!

For an array of N distinct numbers in increasing order, there are N! ways to permute that array. Those permuted arrays can then also be sorted, prioritizing whichever array has the smallest element in the first position, then breaking ties with the second position, etc.

The input is an array and a number M with 0 <= M < N! , and the output should be, if one sorted all N! permutations of the original array, the Mth element of that list of permutations. So, M = 0 would give your original sorted array, and M=N!-1 would be the array in reverse.

| Input | Output |
|-------|--------|
|[1, 2, 3, 4], 5|[1, 4, 3, 2]|
|[1, 4, 7], 2|[4, 1, 7]|
|[3, 4, 6, 9, 10], 114|[10, 9, 3, 4, 6]|
|[1, 2, 3], 0|[1, 2, 3]|
Top Answer J
Bubbler
# [J], 2 bytes

    A.

[Try it online!][TIO-k663bb82]

[J]: http://jsoftware.com/
[TIO-k663bb82]: https://tio.run/##PY07C4NAEITr218xpBFhc@w9VBRShEAgEAikPWwtUkgK/f2X9TAWy843s49PPtlqwmVABYZg0Dpb3N7Pe77aXOcGExw8AiL5oiM6ci6qVg8tejgh@Y8RlSP0mL/rYl7roo2SY3hGYMSR0ZiNY2E/0g6dJt4kVW4DSqHYLaNXSzTVp7opxdjD8TituZgDqP4B "J – Try It Online"

Sorry for the boring answer, but this is a bulit-in function which computes the `n`th permutation of the given array in the increasing order.

```
    5 A. 1 2 3 4
1 4 3 2

    114 A. 3 4 6 9 10
10 9 3 4 6
```
Answer #2
xigoi
# [Jelly], 3 bytes

    ‘œ?

[Try it online!][TIO-khqipumw]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-khqipumw]: https://tio.run/##y0rNyan8//9Rw4yjk@3///9vaGjyP9pYR8FER8FMR8FSR8HQIBYA "Jelly – Try It Online"

Jelly has a built-in for this (`œ?`), but it indexes from 1, so the number has to be incremented (`‘`).

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.