#include <bits/stdc++.h>
using namespace std;
void test_case() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  vector<vector<int> > dp(n + 1, vector<int>(n + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
      dp[i + 1][j + 1] = max(dp[i][j] + (v[i + 1] == j + 1), dp[i + 1][j + 1]);
    }
  }
  int ans = -1;
  for (int i = n; i >= 0; i--) {
    if (dp[n][i] >= k) {
      ans = n - i;
      break;
    }
  }
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    test_case();
  }
}
