#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    int k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int cnt = 1;
    for (int i = 1; i < n; i++) {
      if (a[i] == a[i - 1]) {
        continue;
      } else
        cnt++;
    }
    if (k >= cnt) {
      cout << "1"
           << "\n";
    } else if (k == 1) {
      if (cnt == 1) {
        cout << "1"
             << "\n";
      } else {
        cout << "-1"
             << "\n";
      }
    } else {
      int ans = 0;
      cnt -= k;
      ans += 1;
      if (cnt % (k - 1) == 0) {
        ans += cnt / (k - 1);
      } else {
        ans += (cnt / (k - 1)) + 1;
      }
      cout << ans << "\n";
    }
  }
}
