#include <bits/stdc++.h>
using namespace std;
int t, n, k, a[105], vis[105];
int main() {
  cin >> t;
  while (t--) {
    memset(vis, 0, sizeof(vis));
    int cnt = 0, ans = 1;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (vis[a[i]] == 0) {
        cnt++;
        vis[a[i]] = 1;
      }
    }
    if (k == 1 && cnt > 1) {
      cout << -1 << endl;
      continue;
    }
    if (cnt <= k)
      cout << 1 << endl;
    else {
      cnt -= k;
      while (cnt > 0) {
        cnt -= k - 1;
        ans++;
      }
      cout << ans << endl;
    }
  }
  return 0;
}
