Just Shuffle
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Given a permutation with size and an integer , you should find a permutation substitution that will become after performing substitution for exactly times. Print the permutation after performing for once on . If there are multiple solutions, print any of them. If there is no solution, print "-1" in one line.

输入描述:

The first line contains two integers .
The second line contains integers , denoting the permutation .
It is guaranteed that is a prime number.

输出描述:

If there exists solutions, print n integers in one line, or print "-1" in one line.
示例1

输入

复制
3 998244353
2 3 1

输出

复制
3 1 2