#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    set<int> v;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.insert(x);
    }
    set<int>::reverse_iterator it;
    int p, q, r = 0, s;
    p = v.size();
    for (it = v.rbegin(); it != v.rend(); it++) {
      q = *it;
      if (q - p <= k) {
        r = 1;
        break;
      }
      p--;
    }
    if (!r)
      q = k;
    else if (q - p < k) {
      k -= q - p;
      q += k;
    }
    cout << q << endl;
  }
  return 0;
}
