You are given a permutation p of length n and a positive integer k \leq n.
In one operation, you:
Choose k distinct elements p_{i_1}, p_{i_2}, \ldots, p_{i_k}.
Remove them and then add them sorted in increasing order to the end of the permutation.
For example, if p=[2,5,1,3,4] and k=2 and you choose 5 and 3 as the elements for the operation, then:
[2,5,1,3,4] \rightarrow[2,1,4,3,5].
Find the minimum number of operations needed to sort the permutation in increasing order. It can be proven that it is always possible to do so.
Output
For each test case output a single integer - the minimum number of operations needed to sort the permutation. It can be proven that it is always possible to do so.
Sample I/O
Sample Input
4
3 2
1 2 3
3 1
3 1 2
4 2
1 3 2 4
4 2
2 3 1 4
Sample Output
0
1
1
2
Explanation
In the first test case, the permutation is already sorted.
In the second test case, you can choose element 3, and the permutation will become sorted as follows: [3,1,2]\rightarrow[1,2,3].
In the third test case, you can choose elements 3 and 4, and the permutation will become sorted as follows: [1,3,2,4]\rightarrow[1,2,3,4]
In the fourth test case, it can be shown that it is impossible to sort the permutation in one operation. However, if you choose elements 2 and 1 in the first operation, and choose elements 3 and 4 in the second operation, the permutation will become sorted as follows: [2,3,1,4]\rightarrow[3,4,1,2]\rightarrow[1,2,3,4].