#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const long long inf = 1e18;
int n, k, t;
int cnt[105];
int main() {
  cin >> t;
  while (t--) {
    memset(cnt, 0, sizeof cnt);
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      int val;
      cin >> val;
      cnt[val]++;
    }
    int tot = 0;
    for (int i = 0; i <= 100; i++)
      if (cnt[i]) tot++;
    if (k == 1 && tot > 1)
      cout << -1 << endl;
    else if (tot > k)
      cout << (1 + (tot - k) / (k - 1) + ((tot - k) % (k - 1) != 0)) << endl;
    else
      cout << 1 << endl;
  }
  return 0;
}
