#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, x, n, a;
  cin >> t;
  while (t--) {
    cin >> n >> x;
    set<int> s;
    set<int>::iterator itr;
    for (int i = 0; i < n; i++) {
      cin >> a;
      s.insert(a);
    }
    int id = 1, count = 0;
    for (itr = s.begin(); itr != s.end(), count <= x;) {
      if (*itr == id) {
        id++;
        itr++;
      } else if (count != x) {
        count++;
        id++;
      } else if (count == x)
        count++;
    }
    cout << --id << "\n";
    s.clear();
  }
  return 0;
}
