#include <bits/stdc++.h>
using namespace std;
long long oll = 0;
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T, kas = 1;
  cin >> T;
  while (T--) {
    int n, k;
    cin >> n >> k;
    int arr[n + 10];
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
    }
    if (arr[0] == arr[n - 1]) {
      cout << 1 << "\n";
      continue;
    }
    if (k == 1) {
      if (arr[0] == arr[n - 1])
        cout << 1 << "\n";
      else
        cout << -1 << "\n";
      continue;
    }
    int cmpr[arr[n - 1] + 10][n + 10];
    int mx = arr[n - 1];
    memset(cmpr, 0, sizeof(cmpr));
    for (int i = n - 1; i >= 0; i--) {
      int el = arr[i];
      for (int p = mx - 1; el > 0; p--) {
        cmpr[p][i] = 1;
        el--;
      }
    }
    int st = mx - 1, bt = 0;
    int ans = 0;
    while (bt < st) {
      int temp[n + 10], diff = 0;
      set<int> counter;
      for (long long i = 0; i < n; i++) {
        temp[i] = cmpr[bt][i] + cmpr[bt + 1][i];
        counter.insert(temp[i]);
      }
      diff = counter.size();
      if (diff <= k) {
        for (long long l = 0; l < n; l++) cmpr[bt + 1][l] = temp[l];
        bt++;
        if (bt == mx - 1) {
          ans++;
          break;
        }
      } else {
        ans++, bt++;
        if (bt == mx - 1) {
          ans++;
          break;
        }
      }
    }
    cout << max(1, ans) << "\n";
  }
  return 0;
}
