The first line contains one integer--- the number of test cases.
The first line of each test case contains two integers--- the length of array
, and the length of sub-array Yzk should select.
The second line containsintegers
. --- the elements of array
.
It's guaranteed that the sum ofover all test cases doesn't exceed
(
).
For each test case, output an integer in one line --- the minimum number of operations to make all elements in the arrayequal. If it's impossible to do it, output -1.
In the first test case, we can dooperations as follows:
In the operation, select sub-array
, the minimum element in
is
, then array
changes to
.
In the operation, select sub-array
, the minimum element in
is
, then array
changes to
.