#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k, x;
  cin >> n >> k;
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> x;
    s.insert(x);
  }
  if (k == 1) {
    cout << (s.size() == 1 ? 1 : -1) << endl;
  } else if (s.size() <= k)
    cout << 1 << endl;
  else
    cout << (s.size() - 1 + k - 2) / (k - 1) << endl;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
