#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 100;
const int INF = 0x3f3f3f3f;
const long long MOD = 998244353;
int a[MAXN];
int num[200];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, k;
    cin >> n >> k;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      num[a[i]]++;
    }
    int ans = 0;
    for (int i = 0; i <= 100; i++) {
      if (num[i]) ans++;
    }
    if (ans == 1)
      cout << "1" << endl;
    else if (k == 1 && ans != 1)
      cout << "-1" << endl;
    else {
      if (ans - k <= 0)
        cout << "1" << endl;
      else {
        if ((ans - k) % (k - 1) == 0)
          cout << (ans - k) / (k - 1) + 1 << endl;
        else
          cout << (ans - k) / (k - 1) + 2 << endl;
      }
    }
  }
  return 0;
}
