func_code_string: #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma )   #pragma GCC optimize( unroll-loops )   #include <bits/stdc++.h>    using namespace std;       typedef long long ll;   #define S second   #define v vector   #define dbg(x)              cout<<#x<< = <<(x)<<endl;   #define dbg2(x,y)           cout<<#x<< = <<(x)<<   <<#y<< = <<(y)<<endl;   #define dbg3(x,y,z)         cout<<#x<< = <<(x)<<   <<#y<< = <<(y)<<   <<#z<< = <<(z)<<endl;   #define dbg4(x,y,z,w)       cout<<#x<< = <<(x)<<   <<#y<< = <<(y)<<   <<#z<< = <<(z)<<   <<#w<< = <<(w)<<endl;   #define mp make_pair   #define pb push_back   #define endl                  n    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)          int main()   {    fast_cin();    ll t;    cin >> t;    while (t--)    {        ll x;        ll i;        ll n, flag = 0, mx = 0, mn = 1e10 + 1;        ll k;           cin >> n >> k;        set<ll> s1;        for (i = 0; i < n; i++)        {            cin >> x;            s1.insert(x);      }   ll z =-1;   ll mex = 0;   for (auto it = s1.begin(); it != s1.end();it++)   {   if(*it==z+1)       z++;   else   {       mex = z+1;   }      }   mex = z + 1;   if(k==0)       cout << s1.size() << endl;   else if(mex==*s1.rbegin())   {       cout << s1.size() << endl;      }   else   {       if(mex>*s1.rbegin())           cout << s1.size() + k << endl;   else   {       ll a = (mex + *s1.rbegin());   if(a%2)   {       a = a / 2;       a++;   }   else   {       a /= 2;   }   s1.insert(a);   cout << s1.size() << endl;      }   }      }   return 0;   }