#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  ;
  long long int T, N, X;
  cin >> T;
  while (T--) {
    cin >> N >> X;
    vector<bool> Pl(100100);
    for (long long int i = 0, P; i < N; i++) {
      cin >> P;
      Pl[P - 1] = true;
    }
    for (long long int i = 0; i < 100100; i++) {
      if (!Pl[i] && X > 0) {
        Pl[i] = true;
        X--;
      }
    }
    long long int Counter = 0;
    for (long long int i = 0; i < 100100; i++) {
      if (Pl[i])
        Counter++;
      else
        break;
    }
    cout << Counter << endl;
  }
}
