#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 10;
const int mod = 1e9 + 7;
const int N = 1e2 + 10;
int s[maxx];
int vis[maxx];
int main() {
  int T;
  cin >> T;
  while (T--) {
    memset((vis), (0), sizeof(vis));
    int n, k;
    int pos = 0;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      if (vis[s[i]] != 1) {
        pos++;
        vis[s[i]] = 1;
      }
    }
    int ans;
    if (pos <= k) {
      cout << 1 << endl;
    } else {
      ans = 1;
      pos -= k;
      if ((k - 1) == 0)
        cout << -1 << endl;
      else {
        ans += pos / (k - 1);
        if ((pos % (k - 1)) != 0) ans++;
        cout << ans << endl;
      }
    }
  }
  return 0;
}
