In the C tribe, a grand sacrificial ceremony is held every 5 years. The high priest chants mantras over an ancient rune array, summoning $n$ sprites at various positions. These sprites then leap rapidly along the directions indicated by the rune array.
At each position in the array, there is a symbol pointing to another position. A sprite will jump to the corresponding position at the next moment, and at the following moment, it will jump again according to the symbol at its new location. Sprites will never collide, which means no two positions point to the same position.
Formally, if the symbol at position $i$ points to $f(i)$, then the position of a sprite after $k$ moments is $f_k(i) = f(f_{k-1}(i))$, where $f_0(i) = i$.
The anthropologist Z. Jack, who once visited the site, recorded: "The people of the C tribe believe that they can predict future events through the strange dance of the sprites." He also left behind a photograph from that time, documenting this spectacular scene.
However, the wars of civilized society disturbed the peace of the C tribe, and artillery fire destroyed the ancient rune array. Fifty years later, the people of the C tribe have asked you to restore the array, but the runes in the photograph have become blurred.
The only remaining clues are a few pieces of information: the priest told you that the photograph was taken at the $k$-th moment after the ceremony began. The photograph marks where each sprite originated.
The priest's memory is accurate, and Z. Jack's records are error-free, so you are guaranteed to be able to find one possible original rune array.
Input
The first line contains two integers $n$ and $k$, representing the number of sprite positions in the rune array and the time elapsed since the ceremony began.
The next line contains $n$ integers $1 \le p_i \le n$, representing that the sprite originally at position $i$ has reached position $p_i$ at this time. It is guaranteed that for $i \neq j$, $p_i \neq p_j$.
Output
Output a single line containing $n$ integers, representing the original rune array.
Note that there may be multiple valid answers; you only need to output any one of them.
Examples
Input 1
2 2 1 2
Output 1
2 1
Input 2
10 997 9 7 2 4 10 1 8 3 6 5
Output 2
9 7 2 4 10 1 8 3 6 5
Input 3
See the provided files.
Output 3
See the provided files.
Input 4
See the provided files.
Output 4
See the provided files.
Subtasks
| Test Case | $n$ | $k$ | Special Constraints |
|---|---|---|---|
| $1 \sim 3$ | $\le 10$ | $k \le 10$ | |
| $4 \sim 5$ | $\le 2 \times 10^5$ | ||
| $6$ | $\le 10^5$ | $=2$ | |
| $7 \sim 8$ | $=3$ | ||
| $9 \sim 12$ | $\le 2 \times 10^5$ | $k$ is a prime number | |
| $13 \sim 15$ | $p_i = i+1$ for $i \ne n$, $p_n = 1$ | ||
| $16 \sim 20$ |
For $100\%$ of the data, it is guaranteed that $n \le 10^5$ and $2 \le k \le 2 \times 10^5$.