#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    int ans = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++)
      if (a[i] > ans) {
        if (a[i] == ans + 1)
          ans += 1;
        else if (x > 0 && a[i] - ans - 1 <= x) {
          x = x - (a[i] - ans - 1);
          ans = a[i];
        } else
          break;
      }
    cout << ans + x << endl;
  }
  return 0;
}
