#include <bits/stdc++.h>
const int MAXN = 1e2 + 19;
int n, k, a[MAXN];
int main() {
  int T;
  std::scanf("%d", &T);
  while (T--) {
    std::scanf("%d%d", &n, &k);
    std::scanf("%d", a + 1);
    int num = 0;
    for (int i = 2; i <= n; ++i) {
      std::scanf("%d", a + i);
      if (a[i] != a[i - 1]) ++num;
    }
    --k;
    if (num == 0) {
      std::puts("1");
      continue;
    }
    if (k == 0) {
      std::puts("-1");
      continue;
    }
    std::printf("%d\n", (num + k - 1) / k);
  }
}
