#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int used[105];
    memset(used, 0, sizeof used);
    for (int i = 0; i < n; i++) {
      int w;
      cin >> w;
      used[w]++;
    }
    int unique = 0;
    for (int i = 0; i < 103; i++)
      if (used[i]) unique++;
    if (k == 1) {
      if (unique == 1)
        cout << "1\n";
      else
        cout << "-1\n";
      continue;
    }
    if (k >= unique) {
      cout << "1\n";
      continue;
    }
    int ans = 1;
    unique -= k;
    while (unique > 0) {
      ans++;
      unique -= (k - 1);
    }
    cout << ans << '\n';
  }
}
