#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> arr;
long long answer;
void In() {
  arr.clear();
  cin >> n >> k;
  arr.resize(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
}
void Solve() {
  set<int> diff;
  for (int a : arr) diff.insert(a);
  int num_diff = diff.size();
  if (k == 1) {
    if (num_diff == 1)
      answer = 1;
    else
      answer = -1;
  } else {
    answer = 0;
    if (arr[0] != 0) {
      num_diff -= k;
      num_diff++;
      answer++;
    }
    while (num_diff > 1) {
      num_diff -= k - 1;
      answer++;
    }
  }
}
void Out() { cout << answer << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    In();
    Solve();
    Out();
  }
}
