#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> v;
    v.push_back(INT_MIN);
    for (long long i = 0; i < n; i++) {
      long long val;
      cin >> val;
      v.push_back(val);
    }
    long long a[n + 1][n + 1];
    memset(a, 0, sizeof a);
    if (v[1] == 1) {
      a[1][0] = 1;
    }
    for (long long i = 2; i <= n; i++) {
      for (long long j = 0; j <= i; j++) {
        a[i][j] = a[i - 1][j] + (v[i] == (i - j));
        a[i][j] = max(a[i][j], a[i - 1][j - 1]);
      }
    }
    long long nas = -1;
    for (long long j = 0; j <= n; j++) {
      if (a[n][j] >= k) {
        nas = j;
        break;
      }
    }
    cout << nas << endl;
  }
}
