#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, k;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    long long int a[n];
    set<long long int> s;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
    }
    sort(a, a + n);
    if (k == 1 && s.size() == 1) {
      cout << "1\n";
      continue;
    }
    if (k == 1 && s.size() != 1) {
      cout << "-1\n";
      continue;
    }
    long long int c = 0;
    for (long long int i = 0; i < n - 1; i++) {
      if (a[i + 1] - a[i] != 0) {
        c++;
      }
    }
    long long int o = 1;
    cout << max(o, ((c + k - 2) / (k - 1))) << "\n";
  }
  return 0;
}
