#include <bits/stdc++.h>
using namespace std;
int getmax(vector<int> v) {
  int max = -INT_MAX;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > max) {
      max = v[i];
    }
  }
  return max;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    int xy = getmax(v) + 1000;
    vector<int> map(xy, 0);
    map[0] = -1;
    for (int i = 0; i < v.size(); i++) {
      map[v[i]] += 1;
    }
    for (int i = 0; x > 0; i++) {
      if (map[i] == 0) {
        map[i]++;
        x--;
      }
    }
    int ans = 1;
    while (map[ans] != 0 && ans < map.size()) {
      ans++;
    }
    cout << ans - 1 << endl;
  }
  return 0;
}
