After falling asleep, Max dreamt about a problem:
You are given a permutation,
, of
numbers from
to
. Initially, set
. A move operation is when, for every index
in
simultaneously, the element at index
is moved to index
. Apply the move operation
times.
Since Max was dreaming, he could not solve this problem.
Can you solve Max's dream?
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
Input Specification
The first line will contain and
, the number of elements in the permutation and the number of times to perform the operation, respectively.
The next line will contain space-separated integers,
, the elements of the permutation.
Output Specification
Output the permutation, , after applying the operation
times.
Sample Input 1
5 3
5 3 2 1 4
Sample Output 1
5 2 3 1 4
Explanation for Sample Output 1
After the first operation, the permutation becomes .
After the second operation, the permutation becomes .
After the third and final operation, the permutation becomes .
Sample Input 2
5 1000000000000000000
5 1 2 3 4
Sample Output 2
5 1 2 3 4
Comments