#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const double eps = 1e-7;
const int maxn = 1e6 + 9;
const double pi = acos(-1.0);
const long long inf = 1e17;
const long long mod = 10007;
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    set<int> pq;
    for (int i = 0; i < n; ++i) {
      int tmp;
      cin >> tmp;
      pq.insert(tmp);
    }
    int jk = pq.size();
    if (k == 1) {
      if (jk > k)
        cout << "-1\n";
      else
        cout << "1\n";
    } else {
      if (jk <= k)
        cout << "1\n";
      else {
        int tmp = jk - k;
        int kl = 1 + tmp / (k - 1);
        if (tmp % (k - 1)) ++kl;
        cout << kl << "\n";
      }
    }
  }
  return 0;
}
