#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    int a[n];
    set<int> s;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
    }
    int j = 1;
    for (int i = 0; i < x; i++) {
      while (s.find(j) != s.end()) j++;
      s.insert(j);
    }
    int k = j;
    bool flag = 0;
    while (s.find(k + 1) != s.end()) {
      flag = 1;
      k++;
    }
    if (flag)
      cout << k << endl;
    else
      cout << j << endl;
  }
  return 0;
}
