AdvancedRating 1600
The k-th Permutation
List the permutations of 1 … n in alphabetical (lexicographic) order. Print the k-th.
Input
Two integers n (≤ 20) and k.
Output
n integers.
Sample 1
Input
3 3
Output
2 1 3
Sample 2
Input
4 9
Output
2 3 1 4
Output appears here