#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    s.insert(arr[i]);
  }
  if (k == 1) {
    if (s.size() != 1) {
      cout << "-1\n";
    } else if (s.size() == 1) {
      cout << "1\n";
    }
    return;
  }
  int si = s.size() - k;
  ;
  int res = 1;
  k--;
  if (si > 0) res = res + ceil((si * 1.0) / (k * 1.0));
  cout << res << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
