#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k, res = 0;
    cin >> n >> k;
    int arr[n + 2];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    for (int i = 0; i < n; i++) {
      while (i < n - 1 && arr[i] == arr[i + 1]) i++;
      res++;
    }
    if (k >= res)
      cout << 1 << endl;
    else if (k == 1 && res >= 2) {
      cout << -1 << endl;
    } else if (k == 1 && res == 1) {
      cout << 1 << endl;
    } else {
      int c = 0;
      res -= k;
      c++;
      while (res > 0) {
        res -= k - 1;
        c++;
      }
      cout << c << endl;
    }
  }
}
