#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    bool dec = false;
    int cntd = 0;
    for (int i = 0; i < N; i++) {
      cin >> A[i];
      if (i > 0 && A[i] < A[i - 1]) dec = true;
      if (i > 0 && A[i] != A[i - 1]) cntd++;
    }
    if (dec) {
      cout << "-1\n";
    } else if (cntd < K) {
      cout << "1\n";
    } else if (K == 1)
      cout << "-1\n";
    else {
      cout << (cntd + K - 2) / (K - 1) << "\n";
    }
  }
  return 0;
}
