A dial lock uses each of the numbers 1 through n exactly once in some order. Consider all n! orderings listed in lexicographic (dictionary) order and numbered starting from 1. Given n and an index k, output the k-th ordering in that list.
Input format
Line 1: an integer n.
Line 2: an integer k (1-indexed, with 1 <= k <= n!).
Output format
One line: the k-th permutation of 1..n as n space-separated integers.
Constraints
- 1 <= n <= 8
- 1 <= k <= n!