#include <bits/stdc++.h>
using namespace std;
static bool compare(long long a, long long b) { return a > b; }
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n + 1, 0);
  for (long long i = 1; i < n + 1; ++i) cin >> v[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, 0));
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < i + 1; ++j) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      dp[i + 1][j + 1] =
          max(dp[i + 1][j + 1], dp[i][j] + (v[i + 1] == j + 1 ? 1 : 0));
    }
  }
  long long ans = -1;
  for (long long i = n; i >= 0; i--) {
    if (dp[n][i] >= k) {
      ans = n - i;
      break;
    }
  }
  cout << ans << endl;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
