#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int a[n];
    long long int x;
    set<long long int> s;
    long long int flag = 0;
    for (long long int i = 0; i < n; i++) {
      cin >> x;
      if (x == 0) flag = 1;
      s.insert(x);
    }
    long long int l = s.size();
    if (k == 1 && s.size() > 1)
      cout << "-1" << endl;
    else {
      if (k >= s.size())
        cout << "1" << endl;
      else
        cout << ceil((double)(l - 1) / (k - 1)) << endl;
    }
  }
  return 0;
}
