An identity permutation of length $$$n$$$ is an array $$$[1, 2, 3, \dots, n]$$$.
We performed the following operations to an identity permutation of length $$$n$$$:
You are given the values of $$$n$$$ and $$$m$$$, and the resulting array. Your task is to find all possible values of $$$k$$$ in the cyclic shift operation.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases.
Each test case consists of two lines. The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 3 \cdot 10^5$$$; $$$0 \le m \le \frac{n}{3}$$$).
The second line contains $$$n$$$ integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le n$$$, each integer from $$$1$$$ to $$$n$$$ appears in this sequence exactly once) — the resulting array.
The sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.
For each test case, print the answer in the following way:
4 4 1 2 3 1 4 3 1 1 2 3 3 1 3 2 1 6 0 1 2 3 4 6 5
1 3 1 0 3 0 1 2 0
Consider the example:
Name |
---|