The first line of the input contains two integers $n$, $k$ ($1 \le n \le 10^6$, $1 \le k \le 10^9$) --- the length of the permutation and the number of repetitions of operations, respectively.

The second line contains the permutation $p$ ($1 \le p_i \le n$).