#include <bits/stdc++.h>
using namespace std;
const int mx = 1e4;
int a, b, c, t, n, x, d, i;
int main() {
  cin >> t;
  while (t--) {
    cin >> a >> b;
    int array[mx];
    memset(array, 0, sizeof(array));
    for (i = 0; i < a; i++) {
      cin >> n;
      array[n] = 1;
    }
    int ans = 0;
    while (b) {
      ans++;
      if (array[ans] == 0) {
        array[ans] = 1;
        b--;
      }
    }
    while (array[ans]) {
      ans++;
    }
    cout << ans - 1 << endl;
  }
}
