#include <bits/stdc++.h>
using namespace std;
bool check(int v, vector<int> &a, int x) {
  int ans = 0;
  for (int i = 1; i <= v; ++i) {
    if (a[i] == 0) ++ans;
  }
  return ans <= x;
}
void solve() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n), need(10000);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    need[a[i]] = 1;
  }
  for (int i = 1000; i >= 0; --i) {
    if (check(i, need, x)) {
      cout << i << endl;
      break;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  cin >> test;
  while (test--) {
    solve();
  }
}
