#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while ((t--) > 0) {
    int n, x;
    cin >> n >> x;
    bool present[n + x + 1];
    for (int i = 1; i <= n + x; i++) {
      present[i] = false;
    }
    for (int i = 1; i <= n; i++) {
      int a;
      cin >> a;
      present[a] = true;
    }
    for (int k = n + x; k > 0; k--) {
      int v = 0;
      for (int i = 1; i <= k; i++) {
        if (!present[i]) v++;
      }
      if (v <= x) {
        cout << k << endl;
        break;
      }
    }
  }
}
