#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int t, n, k;
int a[N];
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> k;
    double cnt = 0;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 2; i <= n; i++) {
      if (a[i] != a[i - 1]) cnt++;
    }
    if (k == 1) {
      if (!cnt)
        cout << 1 << endl;
      else
        cout << -1 << endl;
    } else if (!cnt)
      cout << 1 << endl;
    else
      cout << int(ceil(cnt / (k - 1))) << endl;
  }
  return 0;
}
