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