#include <bits/stdc++.h>
using namespace std;
int n, x, a[10005], T;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &x);
    int ans = x;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    int p = unique(a + 1, a + n + 1) - a - 1;
    for (int i = 1; i <= p; i++)
      if (a[i] - i <= x) ans = max(ans, x + i);
    printf("%d\n", ans);
  }
}
