#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n];
    set<int> s;
    bool ok = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
      if (!a[i]) ok = 1;
    }
    if (k == 1) {
      if (s.size() == 1)
        cout << 1 << endl;
      else
        cout << -1 << endl;
      continue;
    }
    k--;
    cout << max(1, (int)(s.size() + k - 2) / k) << endl;
  }
}
