#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, x;
    cin >> n >> x;
    set<long long> s;
    for (long long i = 0; i < n; i++) {
      long long a;
      cin >> a;
      s.insert(a);
    }
    long long ans = 1;
    while (x > 0) {
      if (s.find(ans) != s.end()) {
        ans++;
        continue;
      }
      s.insert(ans);
      ans++;
      x--;
    }
    ans = 1;
    while (s.find(ans) != s.end()) ans++;
    cout << ans - 1 << endl;
  }
}
