#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[105];
void solve() {
  int n, k;
  scanf("%d%d", &n, &k);
  int cnt = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 2; i <= n; i++) {
    if (a[i] != a[i - 1]) cnt++;
  }
  if (cnt == 0) {
    printf("1\n");
    return;
  }
  for (int i = 1; i <= cnt; i++) {
    int tmp = cnt / i;
    if (cnt % i) tmp++;
    if (tmp + 1 <= k) {
      printf("%d\n", i);
      return;
    }
  }
  printf("-1\n");
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
