#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[n + 10], f[200] = {0};
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      f[a[i]]++;
    }
    long long unique = 0;
    for (int i = 0; i < 101; i++) {
      if (f[i] > 0) unique++;
    }
    if (unique > 1 && k == 1)
      cout << "-1\n";
    else {
      if (unique <= k)
        cout << "1\n";
      else {
        if ((unique - k) % (k - 1) == 0)
          cout << ((unique - k) / (k - 1)) + 1 << "\n";
        else
          cout << ((unique - k) / (k - 1)) + 2 << "\n";
      }
    }
  }
}
