A cipher wheel displays n tumblers, each showing an integer, forming an arrangement. Repeatedly advancing the wheel replaces the arrangement with the next one in lexicographic order among all distinct arrangements of the same multiset of values; advancing from the lexicographically largest arrangement wraps back to the smallest. Starting from the given arrangement, advance the wheel exactly k times and output the resulting arrangement.
Input format
Line 1: two integers n and k.
Line 2: n space-separated integers, the starting arrangement.
Output format
n space-separated integers on one line: the arrangement after advancing k times.
Constraints
- 1 ≤ n ≤ 8
- 0 ≤ k ≤ 1000000000
- 1 ≤ each value ≤ 1000000