#include <bits/stdc++.h>
template <class T>
T read(T &a) {
  a = 0;
  char x = getchar();
  bool f = 0;
  for (; x < '0' || x > '9'; x = getchar()) f |= x == '-';
  for (; x >= '0' && x <= '9'; x = getchar()) a = (a << 3) + (a << 1) + x - '0';
  if (f) a = -a;
  return a;
}
using namespace std;
const int N = 105;
int d[N], n, k;
int main() {
  int T;
  read(T);
  d[0] = -0x3f3f3f3f;
  while (T--) {
    read(n), read(k);
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
      read(d[i]);
      cnt += d[i] != d[i - 1];
    }
    if (cnt > 1 && k == 1) {
      puts("-1");
      continue;
    }
    int ans = 1;
    cnt -= k;
    k--;
    while (cnt > 0) {
      ans++;
      cnt -= k;
    }
    cout << ans << endl;
  }
  return 0;
  return 0;
}
