#include <bits/stdc++.h>
using namespace std;
long long int modinverse(long long int x, long long int y) {
  if (y == 0) {
    return 1;
  }
  long long int p = modinverse(x, y / 2) % 1000000007;
  p = (p * p) % 1000000007;
  return (y % 2 == 0) ? p : (x * p) % 1000000007;
}
long long int modexp(long long int a, long long int n) {
  long long int ans = 1;
  a = a % 1000000007;
  while (n > 0) {
    if (n % 2) {
      ans = (ans * a) % 1000000007;
    }
    n /= 2;
    a = (a * a) % 1000000007;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int tt = 1;
  cin >> tt;
  for (long long int tc = 1; tc <= tt; tc++) {
    long long int n, k;
    cin >> n >> k;
    long long int arr[n];
    for (long long int i = 0; i <= n - 1; i++) {
      cin >> arr[i];
    }
    bool flag = 1;
    for (long long int i = 1; i <= n - 1; i++) {
      if (arr[i] != arr[i - 1]) {
        flag = 0;
      }
    }
    if (flag) {
      cout << "1";
    } else if (k == 1) {
      cout << "-1";
    } else {
      set<string> Set;
      while (arr[n - 1] > 0) {
        string temp = "";
        for (long long int i = 0; i <= n - 1; i++) {
          if (arr[i] == 0) {
            temp += '0';
          } else {
            temp += '1';
            arr[i]--;
          }
        }
        Set.insert(temp);
      }
      string s = "";
      for (long long int i = 0; i <= n - 1; i++) {
        s += '1';
      }
      long long int ans = 0, m = Set.size();
      if (Set.find(s) != Set.end()) {
        m--;
      }
      k--;
      ans = m / k;
      if (m % k != 0) {
        ans++;
      }
      cout << ans;
    }
    cout << '\n';
  }
  return 0;
}
