#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  const long long inf = -1e9;
  vector<long long> dp(n + 1, inf);
  dp[0] = 0;
  for (long long i = 0; i < n; i++) {
    vector<long long> temp(n + 1);
    for (long long j = 0; j <= n; j++) {
      temp[j] = dp[j];
      if (a[i] == i + 1 - j) {
        temp[j]++;
      }
    }
    for (long long j = 0; j < n; j++) {
      temp[j + 1] = max(temp[j + 1], dp[j]);
    }
    dp = temp;
  }
  long long ans = -1;
  for (long long i = 0; i <= n; i++) {
    if (dp[i] >= k) {
      ans = i;
      break;
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  long long _ = 1;
  while (t--) {
    solve();
  }
  return 0;
}
