#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(2001);
  for (long long int i = 1; i <= n; ++i) cin >> a[i];
  vector<vector<long long int> > dp(n + 1, vector<long long int>(n + 1, 0));
  vector<long long int> d(2001);
  for (long long int i = 1; i <= n; ++i) d[i] = a[i] - i;
  for (long long int i = 1; i <= n; ++i) {
    dp[0][i] = dp[0][i - 1] + (a[i] == i);
  }
  for (long long int i = 0; i < n; ++i) {
    for (long long int j = 1; j <= n; ++j) {
      if (i > 0)
        dp[i][j] = max(dp[i][j - 1] + (d[j] + i == 0), dp[i - 1][j - 1]);
      if (dp[i][j] >= k) {
        cout << i << "\n";
        return;
      }
    }
  }
  cout << "-1\n";
}
int main() {
  std::ios_base::sync_with_stdio(false);
  long long int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
