#include <bits/stdc++.h>
using namespace std;
const int fx[] = {+1, -1, +0, +0};
const int fy[] = {+0, +0, +1, -1};
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
const long long int N = 1e2 + 10;
long long int n, k;
long long int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    long long int a[n];
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long int sum = 1;
    for (long long int i = 1; i < n; i++) {
      sum += (a[i] != a[i - 1]);
    }
    if (k == 1) {
      if (sum == 1) {
        cout << 1 << endl;
      } else {
        cout << -1 << endl;
      }
      continue;
    }
    long long int ans = (sum + k - 3) / (k - 1);
    cout << max(1LL, ans) << endl;
  }
  return 0;
}
