#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << " , ";
  err(++it, args...);
}
const long long INF = 1e9 + 7;
const long long MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long h, i, j, k, d, l, r, x, y, a, b, c, v, var, n, m, z, s, ans, ind1,
      ind2, flag, limit1, limit2, limit3, mod;
  long long tt;
  cin >> tt;
  while (tt--) {
    cin >> n >> x;
    long long arr[n], freq[1000] = {0};
    for (i = 0; i < n; i++) {
      cin >> arr[i];
      freq[arr[i]] = 1;
    }
    s = 0;
    for (i = 1; i <= 1000; i++) {
      if (freq[i] == 0) s++;
      if (s > x) break;
    }
    cout << i - 1 << "\n";
  }
}
