#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
	int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n+1];
        //a[0]=0;
        for(i=0;i<=n;i++)
            cin>>a[i];
        int cnt=1,prev=0;
        sort(a,a+n+1);
        for(i=0;i<=n;i++)
        {
            if(a[i]<=cnt)
            {
                //cout<<"hi"<<endl;
                cnt+=1;
                prev=i;
            }
            else
            {
                if(a[i]<=cnt+i-prev)
                {
                    cnt+=i-prev;
                    prev=i;
                }
            }
           // cout<<"i "<<i<<" cnt "<<cnt<<" prev "<<prev<<endl;
        }
        cout<<cnt<<endl;

    }
	return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();++it)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1>0)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  it1--;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
    }
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();++it)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1>0)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  --it1;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
    }
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        scanf("%d", &t);
        int res;
        bool flag;
        while(t--){
                scanf("%d", &n);
                vector<int> a(n);
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a.begin(), a.end());
                flag = false;
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                flag = true;
                                break;
                        }
                }
                if (!flag){
                        printf("1\n");
                }
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        vector<int> a(n);
        scanf("%d", &t);
        int res;
        bool flag;
        while(t--){
                scanf("%d", &n);
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a.begin(), a.end());
                flag = false;
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                flag = true;
                                break;
                        }
                }
                if (!flag){
                        printf("1\n");
                }
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        vector<int> a;
        scanf("%d", &t);
        int res;
        bool flag;
        while(t--){
                scanf("%d", &n);
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a.begin(), a.end());
                flag = false;
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                flag = true;
                                break;
                        }
                }
                if (!flag){
                        printf("1\n");
                }
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int t,n;

#define LOCAL

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        scanf("%d", &t);
        int res;
        bool flag;
        while(t--){
                scanf("%d", &n);
                vector<int> a(n);
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a.begin(), a.end());
                flag = false;
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                flag = true;
                                break;
                        }
                }
                if (!flag){
                        printf("1\n");
                }
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        int a[n + 10];
        scanf("%d", &t);
        int res;
        bool flag;
        while(t--){
                cin >> n;
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a, a + n);
                flag = false;
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                flag = true;
                                break;
                        }
                }
                if (!flag){
                        printf("1\n");
                }
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        int a[n];
        cin >> t;
        int res;
        while(t--){
                cin >> n;
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a, a + n);
                res = 1;
                for (int i = 0; i < n; i++){
                        if (a[i] <= i + 1){
                                res = i + 2;
                        }
                }
                printf("%d\n", res);
        }

        return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

using ll = long long;

int t,n;

#define LOCAL = 1

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        int a[n + 10];
        cin >> t;
        int res;
        while(t--){
                cin >> n;
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a, a + n);
                for (int i = n - 1; i >= 0; i--){
                        if (a[i] <= i + 1){
                                printf("%d\n", i + 2);
                                break;
                        }
                }
                printf("1\n");
        }

        return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve() {
            int n;
            cin >> n;
            vector<int> arr(n);
            for (int &el : arr)
                        cin >> el;
            sort(arr.begin(), arr.end());
            for (int i = n - 1; i >= 0; i--) {
                    if (arr[i] <= i + 1) {
                                        cout << i + 2 << '\n';
                                                    return;

                    }

            }
            cout << 1 << '\n';

}

int main() {
            int t;
            cin >> t;
            while (t--)
                    solve();

}


#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

using ll = long long;

int t,n;

int main(){
        #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        #endif

        int a[n + 10];
        cin >> t;
        int res;
        while(t--){
                cin >> n;
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                sort(a, a + n);
                res = 1;
                for (int i = 0; i < n; i++){
                        if (a[i] <= i + 1){
                                res = i + 2;
                        }
                }
                printf("%d\n", res);
        }

        return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t,count=0;
	cin>>t;
	while(t--)
	{

	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    if(t>4)
	    {
	        if((++count)==53)
	        {
	            cout<<n<<" ";
	        for(int i=0;i<n;i++)
	        cout<<a[i]<<" ";
	        }

	    }
	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;

	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(n>=2 && a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    sort(a,a+n);
	 int i=0,count=1;
	   while(a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n)
	        {
	            while(a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }
	            sum=count+cnt;

	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;
	            // cout<<a[i]<<"-"<<sum<<endl;
	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    sort(a,a+n);
	 int i=0,count=1;
	   while(a[i]==a[i+1] && i<n-1)
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;
	            // cout<<a[i]<<"-"<<sum<<endl;
	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t,count=0;
	cin>>t;
	while(t--)
	{

	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    if(n==1)
	    {
	        if(a[0]==1)
	        cout<<2;
	        else
	        cout<<1;
	        cout<<endl;
	        continue;

	    }
	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;

	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(n>=2 && a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t,count=0;
	cin>>t;
	while(t--)
	{

	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    if(n==1)
	    {
	        if(a[0]==1)
	        cout<<2;
	        else
	        cout<<1;
	        cout<<endl;
	        continue;

	    }
	    sort(a,a+n);
	 int i,count;

	    int sum=0,cnt=0;

	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;

	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(n>=2 && a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;

	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    sort(a,a+n);
	 int i=0,count=1;
	   while(a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;
	            // cout<<a[i]<<"-"<<sum<<endl;
	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t,count=0;
	cin>>t;
	while(t--)
	{

	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    if(t>4)
	    {
	        if((++count)==53)
	        {
	            cout<<n<<" ";
	        for(int i=0;i<n;i++)
	        cout<<a[i]<<" ";
	        }

	    }
	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;
	            // cout<<a[i]<<"-"<<sum<<endl;
	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];

	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;
	            // cout<<a[i]<<"-"<<sum<<endl;
	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t,count=0;
	cin>>t;
	while(t--)
	{

	    int n;
	    cin>>n;

	    int a[n];

	    for(int i=0;i<n;i++)
	    cin>>a[i];
	   if(n==1)
	   {
	       if(a[i]==1)
	       cout<<2;
	       else
	       cout<<1;
	       continue;
	   }
	    sort(a,a+n);
	 int i=0,count=1;
	   while(i<n-1 && a[i]==a[i+1])
	   {
	       count++;
	       i++;
	   }
	    int sum=0,cnt=0;

	    if(a[i]<=count)
	    {
	        i=-1;
	        count=1;
	        while(++i<n-1)
	        {
	            while(i<n-1 && a[i]==a[i+1])
	            {
	            i++;
	            count++;
	            }

	            sum=count+cnt;

	       if(a[i]<=sum)
	      cnt+=count;
	      else
	        {
	         count++;
	         continue;
	        }

	         count=1;

	        }
	       if(n>=2 && a[n-2]!=a[n-1] && a[n-1]<=cnt+1)
	       cnt++;
	        cout<<cnt+1;
	    }
	    else
	    cout<<'1';
	    cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int sum=1;
		cin>>n;
		int arr[n];
		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		//sort(arr,arr+n);
		if(*min_element(arr,arr+n)>1)
			cout<<1<<endl;
		else{
			while(true){

				int mi=INT_MAX;
				for(int i=0;i<n;i++){
					mi=min(mi, arr[i]);
				}
				if(mi>=n){
					break;
				}
				int cnt=0;
				for(int i=0;i<n;i++){
					if(arr[i]==mi){
						cnt++;
						arr[i]=INT_MAX;
					}
				}
				if(cnt+sum>=mi){
					sum+=cnt;
				}
				else
					break;
			}
			cout<<sum<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int ans=1;
		cin>>n;
		int arr[n];

		for(int i=0;i<n;i++){
			cin>>arr[i];
		}

		sort(arr,arr+n);
		for(int i=0;i<n;i++){
			if(arr[i]<=i+1){
				ans=i+2;
			}
		}
		cout<<ans<<endl;

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int sum=1;
		cin>>n;
		int arr[n];

		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		if(n==1){
			if(arr[0]==1)
				cout<<2<<endl;
			else
				cout<<1<<endl;
			continue;
		}
		int mi=*min_element(arr,arr+n);
		int cnt=0;
		for(int i=0;i<n;i++){
			if(arr[i]==mi)
				cnt++;
		}
		if(cnt<mi){
			cout<<1<<endl;

		}
		else{
			for(int i=0;i<n;i++){
				if(arr[i]<=n-1&&arr[i]>0)
					sum++;
			}
			cout<<sum<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		int arr[n];
		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		int mi=*min_element(arr,arr+n);
		if(mi>1){
			cout<<1<<endl;
		}
		else{
			int cnt=0;
			for(int i=0;i<n;i++){
				if(arr[i]<n&&arr[i]>0)
					cnt++;
			}
			cout<<cnt+1<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int sum=1;
		cin>>n;
		int arr[n];

		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		if(n==1){
			if(arr[0]==1)
				cout<<2<<endl;
			else
				cout<<1<<endl;
			continue;
		}
		int mi=*min_element(arr,arr+n);
		int cnt=0;
		for(int i=0;i<n;i++){
			if(arr[i]==mi)
				cnt++;
		}
		if(cnt<mi){
			cout<<1<<endl;

		}
		else{
			for(int i=0;i<n;i++){
				if(arr[i]<n)
					sum++;
			}
			cout<<sum<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int sum=1;
		cin>>n;
		int arr[n];
		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		int mi=*min_element(arr,arr+n);
		int cnt=0;
		for(int i=0;i<n;i++){
			if(arr[i]==mi)
				cnt++;
		}
		if(cnt<mi){
			cout<<1<<endl;

		}

		else{
			for(int i=0;i<n;i++){
				if(arr[i]<n&&arr[i]>0)
					sum++;
			}
			cout<<sum<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	fastIO;

	int t;
	cin>>t;
	while(t--){
		int n;
		int sum=1;
		cin>>n;
		int arr[n];

		for(int i=0;i<n;i++){
			cin>>arr[i];
		}
		if(n==1){
			if(arr[0]==1)
				cout<<2<<endl;
			else
				cout<<1<<endl;
			continue;
		}
		int mi=*min_element(arr,arr+n);
		int cnt=0;
		for(int i=0;i<n;i++){
			if(arr[i]==mi)
				cnt++;
		}
		if(cnt<mi){
			cout<<1<<endl;

		}
		else{
			for(int i=0;i<n;i++){
				if(arr[i]<=n&&arr[i]>0)
					sum++;
			}
			cout<<sum<<endl;
		}

	}

	return 0;
}


#include <bits/stdc++.h>
#pragma warning(disable: 4996)
using namespace std;

int t;

int main(void) {
	scanf("%d", &t);
	int n;
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		int tmp;
		vector<int> v;
		multiset<int> s;
		for (int i = 0; i < n; i++) {
			scanf("%d", &tmp);
			v.push_back(tmp);
			s.insert(tmp);
		}
		sort(v.begin(), v.end());
		int cnt = 1;
		for (int i = n-1; i >= 0; i--) {
			if (v[i] <= i + 1) {
				cnt = i + 2;
				break;
			}
		}
		printf("%d\n", cnt);
	}

	return 0;
}


#include <bits/stdc++.h>
#pragma warning(disable: 4996)
using namespace std;

int t;

int main(void) {
	scanf("%d", &t);
	int n;
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		int tmp;
		vector<int> v;
		multiset<int> s;
		for (int i = 0; i < n; i++) {
			scanf("%d", &tmp);
			v.push_back(tmp);
			s.insert(tmp);
		}
		sort(v.begin(), v.end());
		int cnt = 1;
		int notyet = 0;
		for (int i = 0; i < v.size(); i++) {
			//printf("i: %d \tcnt: %d \tnotyet: %d\n", i, cnt, notyet);
			if (s.count(v[i]) - 1 + cnt >= v[i]) {
				//printf("%dth granny can join\n", i);
				cnt++;
				notyet = 0;
			}
			else {
				if (s.count(v[i]) - 1 + cnt + notyet >= v[i]) {
					//printf("%dth granny made it possible\n", i);
					cnt += notyet;
					notyet = 0;
					cnt++;
				}
				else {
					//printf("%dth granny cannot join\n", i);
					notyet++;
					i += s.count(v[i]) - 1;
				}
			}
		}
		printf("%d\n", cnt);
	}

	return 0;
}


#include <bits/stdc++.h>
#pragma warning(disable: 4996)
using namespace std;

int t;

int main(void) {
	scanf("%d", &t);
	int n;
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		int tmp;
		vector<int> v;
		multiset<int> s;
		for (int i = 0; i < n; i++) {
			scanf("%d", &tmp);
			v.push_back(tmp);
			s.insert(tmp);
		}
		sort(v.begin(), v.end());
		int cnt = 1;
		int notyet = 0;
		for (int i = 0; i < v.size(); i++) {
			if (s.count(v[i]) - 1 + cnt >= v[i]) {
				cnt++;
				notyet = 0;
			}
			else {
				if (s.count(v[i]) - 1 + cnt + notyet >= v[i]) {
					cnt += notyet;
					notyet = 0;
					cnt++;
				}
				else {
					notyet++;
				}
			}
		}
		printf("%d\n", cnt);
	}

	return 0;
}


#include <bits/stdc++.h>
#pragma warning(disable: 4996)
using namespace std;

int t;

int main(void) {
	scanf("%d", &t);
	int n;
	while(t--) {
		scanf("%d", &n);
		int tmp;
		vector<int> v;
		multiset<int> s;
		for (int i = 0; i < n; i++) {
			scanf("%d", &tmp);
			v.push_back(tmp);
			s.insert(tmp);
		}
		sort(v.begin(), v.end());
		int cnt = 1;
		int notyet = 0;
		for (int i = 0; i < v.size(); i++) {
			if (s.count(v[i]) - 1 + cnt >= v[i]) {
				cnt++;
				notyet = 0;
			}
			else {
				if (s.count(v[i]) - 1 + cnt + notyet >= v[i]) {
					cnt += notyet;
					notyet = 0;
					cnt++;
				}
				else {
					notyet++;
				}
			}
		}
		printf("%d\n", cnt);
	}

	return 0;
}


#include <bits/stdc++.h>
#pragma warning(disable: 4996)
using namespace std;

int t;

int main(void) {
	scanf("%d", &t);
	int n;
	for (int i = 0; i < t; i++) {
		scanf("%d", &n);
		int tmp;
		vector<int> v;
		multiset<int> s;
		for (int i = 0; i < n; i++) {
			scanf("%d", &tmp);
			v.push_back(tmp);
			s.insert(tmp);
		}
		sort(v.begin(), v.end());
		int cnt = 1;
		int notyet = 0;
		for (int i = 0; i < v.size(); i++) {
			//printf("i: %d \tcnt: %d \tnotyet: %d\n", i, cnt, notyet);
			if (s.count(v[i]) - 1 + cnt >= v[i]) {
				//printf("%dth granny can join\n", i);
				cnt++;
				notyet = 0;
			}
			else {
				if (s.count(v[i]) - 1 + cnt + notyet >= v[i]) {
					//printf("%dth granny made it possible\n", i);
					cnt += notyet;
					notyet = 0;
					cnt++;
				}
				else {
					//printf("%dth granny cannot join\n", i);
					notyet += s.count(v[i]);
					i += s.count(v[i]) - 1;
				}
			}
		}
		printf("%d\n", cnt);
	}

	return 0;
}


//B.
#include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
   int a;
   scanf("%d", &a);
   int length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      scanf("%d", &length);
      for (int i = 0; i < length; i++)
      {
         scanf("%d", &arr[i]);
      }
      sort(arr, arr + length, greater<int>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      printf("%d\n", length - count + 1);
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int a;
   cin >> a;
   int length, count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length, greater<int>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << length - count + 1 << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
#define fastio                       \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);
int main()
{
   fastio;
   int a;
   cin >> a;
   int length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length, greater<int>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}


//B.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   unsigned int a;
   cin >> a;
   unsigned int length;
   int count;
   unsigned int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length, greater<int>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << length - count + 1 << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005];
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   cout << length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      //int arr[length];
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int a;
   cin >> a;
   int length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length, greater<int>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
*/

///*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
#define ll long long //this works
int main()
{
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ll a;
  cin >> a;
  ll length;
  //cout << length;
  ll count;
  //int arr[length]; ///this was causing problem of time limit exceeded
  for (ll i = 0; i < a; i++)
  {
    //cout << "new case here" << endl;
    count = 0;
    cin >> length;
    ll arr[length]; //problem solved!!!
    for (ll i = 0; i < length; i++)
    {
      cin >> arr[i];
    }
    sort(arr, arr + length);
    reverse(arr, arr + length);
    //for (int i = 0; i < length; i++)
    {
      //cout << arr[i];
    }
    //for (int i = length - 1; i > 0; i++)
    for (ll i = 0, variable = length; i < length; i++, variable--)
    {
      ;
      if (arr[i] > variable)
      {
        count = count + 1;
      }
      else
      {
        break;
      }
    }
    //cout << count << " " << length << endl;
    cout << (length - count + 1) << endl;
  }
  return 0;
}
//*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005];
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length];
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
#define intt long long
#define fastio                       \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);
int main()
{
   fastio;
   intt a;
   cin >> a;
   intt length;
   intt count;
   intt arr[length];
   for (intt i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (intt i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length, greater<intt>());
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (intt i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
#define ll long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   ll a;
   cin >> a;
   ll length;
   //cout << length;
   ll count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (ll i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      ll arr[length]; //problem solved!!!
      for (ll i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (ll i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

///*
//B.
#include <iostream>
#include <algorithm>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
//*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
#define ll long long //this works
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   ll a;
   cin >> a;
   ll length;
   //cout << length;
   ll count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (ll i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      ll arr[length]; //problem solved!!!
      for (ll i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (ll i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
int arr[100005];
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   int count;
   //intt arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

///*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int a;
  cin >> a;
  int length;
  //cout << length;
  int count;
  //int arr[length]; //this was causing problem of time limit exceeded
  for (int i = 0; i < a; i++)
  {
    //cout << "new case here" << endl;
    count = 0;
    cin >> length;
    int arr[length]; //problem solved!!!
    for (int i = 0; i < length; i++)
    {
      cin >> arr[i];
    }
    sort(arr, arr + length);
    reverse(arr, arr + length);
    //for (int i = 0; i < length; i++)
    {
      //cout << arr[i];
    }
    //for (int i = length - 1; i > 0; i++)
    for (int i = 0, variable = length; i < length; i++, variable--)
    {
      ;
      if (arr[i] > variable)
      {
        count = count + 1;
      }
      else
      {
        break;
      }
    }
    //cout << count << " " << length << endl;
    cout << (length - count + 1) << endl;
  }
  return 0;
}
//*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
int arr[100005];     //problem solved!!!
#define ll long long //this works
int main()
{
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ll a;
  cin >> a;
  ll length;
  //cout << length;
  ll count;
  // int arr[length]; ///this was causing problem of time limit exceeded
  for (ll i = 0; i < a; i++)
  {
    //cout << "new case here" << endl;
    count = 0;
    cin >> length;
    // ll arr[length]; //problem solved!!!
    for (ll i = 0; i < length; i++)
    {
      cin >> arr[i];
    }
    sort(arr, arr + length);
    reverse(arr, arr + length);
    //for (int i = 0; i < length; i++)
    {
      //cout << arr[i];
    }
    //for (int i = length - 1; i > 0; i++)
    for (ll i = 0, variable = length; i < length; i++, variable--)
    {
      ;
      if (arr[i] > variable)
      {
        count = count + 1;
      }
      else
      {
        break;
      }
    }
    //cout << count << " " << length << endl;
    cout << (length - count + 1) << endl;
  }
  return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005];
//#define intt long long
int main()
{
   //ios::sync_with_stdio(0);
   //cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   int count;
   int arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      //int arr[length];
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
*/

///*
//B.
#include <bits/stdc++.h>
using namespace std;
int arr[100005];     //problem solved!!!
#define ll long long //this works
int main()
{
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ll a;
  cin >> a;
  ll length;
  //cout << length;
  ll count;
  // int arr[length]; ///this was causing problem of time limit exceeded
  for (ll i = 0; i < a; i++)
  {
    //cout << "new case here" << endl;
    count = 0;
    cin >> length;
    // ll arr[length]; //problem solved!!!
    for (ll i = 0; i < length; i++)
    {
      cin >> arr[i];
    }
    sort(arr, arr + length);
    reverse(arr, arr + length);
    //for (int i = 0; i < length; i++)
    {
      //cout << arr[i];
    }
    //for (int i = length - 1; i > 0; i++)
    for (ll i = 0, variable = length; i < length; i++, variable--)
    {
      ;
      if (arr[i] > variable)
      {
        count = count + 1;
      }
      else
      {
        break;
      }
    }
    //cout << count << " " << length << endl;
    cout << (length - count + 1) << endl;
  }
  return 0;
}
//*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

/*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
//#define intt long long
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   //cout << length;
   int count;
   //int arr[length]; //this was causing problem of time limit exceeded
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length]; //problem solved!!!
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}
*/

///*
//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005]; //problem solved!!!
#define ll long long //this works
int main()
{
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ll a;
  cin >> a;
  ll length;
  //cout << length;
  ll count;
  //int arr[length]; //this was causing problem of time limit exceeded
  for (ll i = 0; i < a; i++)
  {
    //cout << "new case here" << endl;
    count = 0;
    cin >> length;
    ll arr[length]; //problem solved!!!
    for (ll i = 0; i < length; i++)
    {
      cin >> arr[i];
    }
    sort(arr, arr + length);
    reverse(arr, arr + length);
    //for (int i = 0; i < length; i++)
    {
      //cout << arr[i];
    }
    //for (int i = length - 1; i > 0; i++)
    for (ll i = 0, variable = length; i < length; i++, variable--)
    {
      ;
      if (arr[i] > variable)
      {
        count = count + 1;
      }
      else
      {
        break;
      }
    }
    //cout << count << " " << length << endl;
    cout << (length - count + 1) << endl;
  }
  return 0;
}
//*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
//int arr[100005];
//#define intt long long
int main()
{
   //ios::sync_with_stdio(0);
   //cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   int count;
   //intt arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      int arr[length];
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


/*
//A.
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int test_case;
   cin >> test_case;
   int arr1[test_case], arr2[test_case];
   for (int i = 0; i < test_case; i++)
   {
      //cout << "case first";
      cin >> arr1[i] >> arr2[i];
      if ((arr1[i] * arr2[i]) % 2 == 0)
      {
         cout << (arr1[i] * arr2[i]) / 2 << endl;
      }
      else
      {
         cout << ((arr1[i] * arr2[i]) / 2) + 1 << endl;
      }
   }
   return 0;
}
*/

//B.
#include <bits/stdc++.h>
using namespace std;
int arr[100005];
//#define intt long long
int main()
{
   //ios::sync_with_stdio(0);
   //cin.tie(NULL), cout.tie(NULL);
   int a;
   cin >> a;
   int length;
   int count;
   //intt arr[length];
   for (int i = 0; i < a; i++)
   {
      //cout << "new case here" << endl;
      count = 0;
      cin >> length;
      for (int i = 0; i < length; i++)
      {
         cin >> arr[i];
      }
      sort(arr, arr + length);
      reverse(arr, arr + length);
      //for (int i = 0; i < length; i++)
      {
         //cout << arr[i];
      }
      //for (int i = length - 1; i > 0; i++)
      for (int i = 0, variable = length; i < length; i++, variable--)
      {
         ;
         if (arr[i] > variable)
         {
            count = count + 1;
         }
         else
         {
            break;
         }
      }
      //cout << count << " " << length << endl;
      cout << (length - count + 1) << endl;
   }
   return 0;
}

/*
#include <bits/stdc++.h>
using namespace std;

int A[100005];

int main()
{
   ios::sync_with_stdio(0);
   cin.tie(NULL), cout.tie(NULL);

   int t;
   cin >> t;

   while (t--)
   {
      int n;
      cin >> n;

      for (int i = 1; i <= n; i++)
         cin >> A[i];

      int ans = 1;
      sort(A + 1, A + 1 + n);

      for (int i = 1; i <= n; i++)
         if (A[i] <= i)
            ans = i + 1;

      cout << ans << "\n";
   }

   return 0;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int

signed main(){
   int t;
   cin>>t;
   while(t--){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
    cin>>a[i];
    }
    int sum=1;

    sort(a.begin(),a.end());

   if(a[0]-sum!=0)
   cout<<1<<endl;
   else
   {
       for(int i=0;i<n;i++){
           if(a[i]<=i+1)
           sum=i+1;

       }
       cout<<sum+1<<endl;
   }

   }

}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
signed main(){
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        int a[n + 1];
        for (int i = 1; i <= n; ++i)
        cin >> a[i];
        sort(a + 1, a + n + 1);
        int i;
        for (i = n; i > 0; i--)
        if (a[i] <= i)
        break;
        cout << i + 1<< "\n" ;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int

signed main(){
   int t;
   cin>>t;
   while(t--){
    int n;
    cin>>n;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
    cin>>a[i];
    }
    int sum=1+n;

    sort(a.begin(),a.end());

   if(a[1]-1!=0)
   cout<<1<<endl;
   else
   {
       for(int i=n;i>0;i--){
           if(a[i]<=i)
           break;
           else
           sum--;
 }
       cout<<sum<<endl;
   }

   }

}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int

signed main(){
   int t;
   cin>>t;
   while(t--){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
    cin>>a[i];
    }
    int sum=1;
    int i=n;
    sort(a.begin(),a.end());

   if(a[0]-sum!=0)
   cout<<1<<endl;
   else
   {
       for( i=n;i>0;i--){
           if(a[i-1]<i+sum)
           break;

       }
       cout<<sum+i<<endl;
   }

   }

}


#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int

signed main(){
   int t;
   cin>>t;
   while(t--){
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
    cin>>a[i];
    }
    int sum=1+n;

    sort(a.begin(),a.end());

   if(a[0]-1!=0)
   cout<<1<<endl;
   else
   {
       for(int i=n;i>0;i--){
           if(a[i-1]>i)
           sum--;
           else
           break;
 }
       cout<<sum<<endl;
   }

   }

}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];

	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;

		}
		else
		{j=i+1;
		k++;
		if(a[j]<=k&&j!=n-1)
		c=k;
		}

	}
	cout<<c<<"\n";
}
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];
    sort(a,a+n);
	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;
           // cout<<c<<" ";
		}
		else
		{if(i!=n-1)
			j=i+1;
		k++;
		if(a[j]<=k)
		{c=k;

		}
		}

	}
cout<<c<<"\n";
}
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];
    sort(a,a+n);
	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;
           // cout<<c<<" ";
		}
		else
		{
		if(i!=n-1)
		j=i+1;
		else
		break;
		k++;
		if(a[j]<=k)
		{c=k;

		}
		}

	}
cout<<c<<"\n";
}
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;
			continue;
		}
		else
		{j=i+1;
		 k++;
		 if(a[j]<=k&&j!=n-1)
		c=k;
		}

	}
	cout<<c<<"\n";
}
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];
    sort(a,a+n);
	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;
           // cout<<c<<" ";
		}
		else
		{j=i+1;
		k++;
		if(a[j]<=k&&j!=n-1)
		{c=k;

		}
		}

	}
cout<<c<<"\n";
}
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
long long int t;
cin>>t;
while(t--)
{long long int n;
	cin>>n;
	long long int a[n];
	for(long int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	long long int c=1,k=1,j;
	for(long long int i=0;i<n;i++)
	{
		if(a[i]<=c)
		{
			c++;k++;
			continue;
		}
		else
		{j=i+1;
		 k++;
			if(a[j]<=k)
			c=k;
		}

	}
	cout<<c<<"\n";
}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long int t;
	cin>>t;

	while(t--)
	{
		long long int n;
		cin>>n;

		long long int ar[n+1];
		for(int i=1;i<=n;i++)
		cin>>ar[i];

		sort(ar,ar+n);
		int ct = 0;

		for(int i=1;i<=n;i++)
		if(ar[i] <= 1 + (i-1))
		ct = i;

		cout<<ct+1<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int t;
	cin>>t;

	while(t--)
	{
		int n;
		cin>>n;

		int ar[n+1];
		for(int i=1;i<=n;i++)
		cin>>ar[i];

		sort(ar,ar+n);
		int ct = 0;

		for(int i=1;i<=n;i++)
		if((i-1)+1>=ar[i])
		ct=i;
	}
	cout<<ct+1<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long int t;
	cin>>t;

	while(t--)
	{
		long long int n;
		cin>>n;

		long long int ar[n];
		for(int i=0;i<n;i++)
		cin>>ar[i];

		sort(ar,ar+n);
		int ct = 0;

		for(int i=0;i<n;i++)
		{
			if(ar[i] <= 1 + (i))
			ct = i+1;
		}

		cout<<ct+1<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int t;
	cin>>t;

	while(t--)
	{
		int n;
		cin>>n;

		int ar[n+1];
		for(int i=1;i<=n;i++)
		cin>>ar[i];

		sort(ar,ar+n);
		int ct = 0;

		for(int i=1;i<=n;i++)
		if((i-1)+1>=ar[i])
		ct=i;

		cout<<ct+1<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int t;
	cin>>t;

	while(t--)
	{
		long long int n;
		cin>>n;
		long long int ar[n];

		for(int i=0;i<n;i++)
		cin>>ar[i];

		int x = 0 ,y = 0;
		sort(ar,ar+n);

		for(int i=0;i<n;i++)
		{
			//cout<<"I:"<<i<<" Ar:"<<ar[i]<<" x+1:"<<x+1<<endl;
			if(ar[i] <= (x + 1))
			{
				x=x+1;
				y = x;
			}
			else if (ar[i] > x+1)
			x++;
		}

		cout<<y+1<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long int t;
	cin>>t;

	while(t--)
	{
		long long int n;
		cin>>n;

		long long int ar[n];
		for(int i=0;i<=n;i++)
		cin>>ar[i];

		sort(ar,ar+n);
		int ct = 0;

		for(int i=0;i<=n;i++)
		if(ar[i] <= 1 + (i))
		ct = i+1;

		cout<<ct+1<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define bs binary_search
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define sll stack<ll>
#define qll queue<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define vc vector <char>
#define vvll vector<vector<ll>>
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
ll mod=1000000007;  double pi=3.1415926535;

void solve()
{
    ll n;   cin>>n;
    ll a[n];    loop(i,0,n)     cin>>a[i];
    set<ll> S;
    unordered_map<ll,ll> M;
    sort(a,a+n);
    loop(i,0,n)
    {
        S.insert(a[i]);
        M[a[i]]++;
    }
    ll cnt=0,cur,na=0;
    for(auto x : S)
    {
        na+=M[x];
        if(cur+M[x]>=x)
        {
            cnt+=na;
            na=0;
        }
        cur+=M[x];
    }
    cout<<cnt+1<<nl;
}

int main() {
	fast_io;

	test{
	    solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define bs binary_search
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define sll stack<ll>
#define qll queue<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define vc vector <char>
#define vvll vector<vector<ll>>
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
ll mod=1000000007;  double pi=3.1415926535;

void solve()
{
    ll n;   cin>>n;
    ll a[n];    loop(i,0,n)     cin>>a[i];
    set<ll> S;
    unordered_map<ll,ll> M;
    loop(i,0,n)
    {
        S.insert(a[i]);
        M[a[i]]++;
    }
    ll cnt=0,cur,nany=0;
    for(ll x : S)
    {
        nany+=M[x];
        if(cur+M[x]>=x)
        {
            cnt+=nany;
            nany=0;
        }
        cur+=M[x];
    }
    cout<<cnt+1<<nl;
}

int main() {
	fast_io;

	test{
	    solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define bs binary_search
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define sll stack<ll>
#define qll queue<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define vc vector <char>
#define vvll vector<vector<ll>>
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
ll mod=1000000007;  double pi=3.1415926535;

void solve()
{
    ll n;   cin>>n;
    ll a[n];    loop(i,0,n)     cin>>a[i];
    set<ll> S;
    map<ll,ll> M;
    sort(a,a+n);
    loop(i,0,n)
    {
        S.insert(a[i]);
        M[a[i]]++;
    }
    ll cnt=0,cur,na=0;
    for(auto x : S)
    {
        na+=M[x];
        if(cur+M[x]>=x)
        {
            cnt+=na;
            na=0;
        }
        cur+=M[x];
    }
    cout<<cnt+1<<nl;
}

int main() {
	fast_io;

	test{
	    solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define bs binary_search
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define sll stack<ll>
#define qll queue<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define vc vector <char>
#define vvll vector<vector<ll>>
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
ll mod=1000000007;  double pi=3.1415926535;

void solve()
{
    ll n;   cin>>n;
    ll a[n];    loop(i,0,n)     cin>>a[i];
    set<ll> S;
    unordered_map<ll,ll> M;
    loop(i,0,n)
    {
        S.insert(a[i]);
        M[a[i]]++;
    }
    ll cnt=0,cur=0,nany=0;
    for(ll x : S)
    {
        nany+=M[x];
        if(cur+M[x]>=x)
        {
            cnt+=nany;
            nany=0;
        }
        cur+=M[x];
    }
    cout<<cnt+1<<nl;
}

int main() {
	fast_io;

	test{
	    solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> a(n);
        for(auto it:a)
            cin>>it;
        sort(a.begin(),a.end());
        for(int i=n-1;i>=0;i--){
            if(a[i]<=i+1){
                cout<<i+2<<endl;
                continue;
            }
        }
        cout<<1<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
       int n;
       cin>>n;
       vector<int> v(n);
       for(int i=0;i<n;i++){
           cin>>v[i];
       }
       if(v[0]!=1){
           cout<<1<<endl;
       }
       else{
           int count=0;
           for(int i=0;i<n;i++){
               if(v[i]<n)
                    count++;
           }
           cout<<count+1<<endl;
       }
    }

}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> a(n);
        for(auto it:a)
            cin>>it;
        sort(a.begin(),a.end());
        for(int i=0;i<n;i++){
            if(a[i]<=i+1){
                cout<<i+2<<endl;
                return;
            }
        }
        cout<<1<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> a(n);
        for(auto it:a)
            cin>>it;
        sort(a.begin(),a.end());
        int flag=0;
        for(int i=n-1;i>=0;i--){
            if(a[i]<=i+1){
                flag=1;
                break;
            }
        }
        if(flag==1){
            cout<<i+2<<endl;
        }
        else{

        cout<<1<<endl;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

int a[101];

int main()
{
    int n, m, i, maxim=-1, contor=0;
    cin >> n;
    cin >> m;
    for (i=1; i<=n; ++i)
        cin >> a[i];
    while (m>0){
        for (i=1; i<=n; ++i)
            if (maxim < a[i])
                maxim = a[i];
        m = m - maxim;
        contor = contor + 1;
        }
    cout << contor;
    return 0;
    }


#include <iostream>

using namespace std;

int a[101];

int main() {
    int n;
    int m;
    cin >> n >> m;
    for (i = 1; i <= n; ++i)
        cin >> a[i];

    int stickuri = 0;

    while (m > 0) {
        int maxim = 0;
        int j;
        for (i = 1; i <= n; ++i)
            if (a[i] > maxim) {
                maxim = a[i];
                j = i;
            }
        a[j] = 0;
        m = m - maxim;
        ++stickuri;
    }
    cout << stickuri;
}


#include <iostream>

using namespace std;

int a[101];

int main() {
    int n;
    int i, m;
    cin >> n >> m;
    for (i = 1; i <= n; ++i)
        cin >> a[i];

    int stickuri = 0;

    while (m > 0) {
        int maxim = 0;
        int j;
        for (i = 1; i <= n; ++i)
            if (a[i] > maxim) {
                maxim = a[i];
                j = i;
            }
        a[j] = 0;
        m = m - maxim;
        ++stickuri;
    }
    cout << stickuri;
}


#include <bits/stdc++.h>

using namespace std;

int a[101];

int main()
{
    int n, m, i, maxim=-1, contor=0;
    cin >> n;
    cin >> m;
    for (i=1; i<=n; ++i)
        cin >> a[i];
    while (m>0){
        for (i=1; i<=n; ++i)
            if (maxim < a[i])
                maxim = a[i];
        m = m - maxim;
        for (i=1; i<=n; ++i)
        if (a[i] == maxim ){
                a[i] = 0;
                break;
        }
        maxim = 0;
        contor = contor + 1;
        }
    cout << contor;
    return 0;
    }


#include <bits/stdc++.h>

using namespace std;

int a[101];

int main()
{
    int n, m, i, maxim=-1, contor=0;
    cin >> n;
    cin >> m;
    for (i=1; i<=n; ++i)
        cin >> a[i];
    while (m>0){
        for (i=1; i<=n; ++i)
            if (maxim < a[i])
                maxim == a[i];
        m = m - maxim;
        contor = contor + 1;
        }
    cout << contor;
    return 0;
    }


#include <iostream>
#include <algorithm>

using namespace std;

int a[1000] ;

int main()
{
    int n , sizee , count=0 , sum=0 ;
    cin >> n >> sizee ;
    for (int i=0 ; i<n ; i++)
    {
        cin >> a[i] ;
    }
    sort (a,a+n) ;
    for (int i=n-1 ; i>0 ; i--)
    {
        sum+=a[i] ;
        if (sum>=sizee)
        {
            break ;
        }
        else
        {
            count++ ;
        }
    }
    cout << count+1 << endl ;
    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int x[100] ;
int main()
{
    int a,b , count=0 ;
    cin >> a >> b ;
    for (int i=0 ; i<a ; i++)
    {
        cin >> x[i] ;
    }
    sort (x,x+a) ;
    for (int i=a ; i>0 ; i--)
        {
            if (x[a]>b)
            {
                count=1 ;
                break ;
            }
            if (x[i]<b)
            {
                count++ ;
                b-=x[i] ;
            }
        }
        cout << count << endl ;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;
int a [10000] ;

int main()
{
    int n , m , sum = 0 , count =0;
    cin >> n >> m ;
    for (int i=0 ; i<n ; i++)
        cin >> a[i] ;
    sort (a,a + n) ;
    for (int j=n - 1 ; j>=0 ; j-- )
        {sum+=a[j] ;
        if (sum > m)
            count++ ;
        }
        cout << count ;
    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int x[100] ;
int main()
{
    int a,b , count=0 ;
    cin >> a >> b ;
    for (int i=0 ; i<a ; i++)
    {
        cin >> x[i] ;
    }
    sort (x,x+a) ;
    for (int i=a ; i>0 ; i--)
        {
            if (x[a]>=b)
            {
                count=1 ;
                break ;
            }
            if (x[i]<b)
            {
                count++ ;
                b-=x[i] ;
            }
        }
        cout << count << endl ;

    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;
int a [10000] ;

int main()
{
    int n , m ;
    cin >> n >> m ;
    for (int i=1 ; i<=n ; i++)
        cin >> a[i] ;
    sort (a+n,a) ;
    int b = 0 , sum = 0 , count = 0;
        for (int j=1 ; j<= a[b] ; j++)
            {
              sum += a[b] ;
              if (m >= sum)
              b++ ;
              count++ ;
            }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool mycom(int x, int y){
    return x>=y;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, a[100], i;
    cin >> n >> m;
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a,a+n,mycom);
    for(i=0; i<n; i++){
        m-=a[i];
        if(m<=0)break;
    }
    cout << i+1;
}


#include <bits/stdc++.h>
using namespace std;
bool mycom(int x, int y){
    return x>=y;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, a[101], i;
    cin >> n >> m;
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a,a+n,mycom);
    for(i=0; i<n; i++){
        m-=a[i];
        if(m<=0)break;
    }
    cout << i+1;
}


#include <bits/stdc++.h>
using namespace std;
bool mycom(int x, int y){
    return x>y;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, a[101], i;
    cin >> n >> m;
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a,a+n,mycom);
    for(i=0; i<n; i++){
        m-=a[i];
        if(m<=0)break;
    }
    cout << i+1;
}


#include <bits/stdc++.h>
using namespace std;
bool mycom(int x, int y){
    return x>y;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, a[100], i;
    cin >> n >> m;
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a,a+n,mycom);
    for(i=0; i<n; i++){
        m-=a[i];
        if(m<=0)break;
    }
    cout << i+1;
}


#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int main() {
	int n;
	cin>>n;
	int m;
	cin>>m;
	for(int i=0;i<n;i++) {
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int c=0;
	int i=n-1;
	while(m>0) {
		m=m-arr[i--];
		c++;
	}
	cout<<c<<endl;
	return 0;
}


#include<bits/stdc++.h>
//#include<algorithm>
//#include<iostream.h>
using namespace std;
int arr[100005];
int main() {
	int n;
	cin>>n;
	int m;
	cin>>m;
	for(int i=0;i<n;i++) {
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int c=0;
	int i=n-1;
	while(m) {
		m/=arr[i--];
		c++;
	}
	cout<<c<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int main() {
	int n;
	cin>>n;
	int m;
	cin>>m;
	for(int i=0;i<n;i++) {
		cin>>arr[i];
	}
	sort(arr,arr+n);
	int c=0;
	int i=n-1;
	while(m>=0) {
		m=m-arr[i--];
		c++;
	}
	cout<<c<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int main() {
    int n;
    cin>>n;
    int m;
    cin>>m;
    for(int i=0;i<n;i++) {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int c=0;
    int i=n-1;
    while(m) {
        m=m-arr[i--];
        c++;
    }
    cout<<c<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,a[111111],i,sum;
int main()
{
	cin >> m >> n;
	for( i = 1; i <= m; i++)
	{
		cin >> a[i];
	}
	sort(a+1,a+m+1);
	for( i = m; i >= 1; i--)
	{

        sum++;
		n-=a[i];
		if(n<1)
		{
			cout << sum;
			return 0;
		}
	}
	cout << m;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,a[111111],i;
int main()
{
	cin >> m >> n;
	for( i = 1; i <= m; i++)
	{
		cin >> a[i];
	}
	sort(a+1,a+m+1);
	for( i = m; i >= 1; i--)
	{
		n-=a[i];
		if(n<1)
		{
			cout << i;
			return 0;
		}
	}
	cout << m;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,a[111111],i;
int main()
{
	cin >> m >> n;
	for( i = 1; i <= m; i++)
	{
		cin >> a[i];
	}
	sort(a+1,a+m+1);
	for( i = m; i >= 1; i--)
	{
		n-=a[i];
		if(!n)
		{
			cout << i;
			return 0;
		}
	}
	cout << m;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a, b, c, counter, total,arr[1010];
int main(){
	cin>>a;
	cin>>b;
	for(int i=0; i<a;i++){
		cin>>c;
		arr[i]=c;
	}
	sort(arr,arr+a-1);
	for(int i=a-1;i>=0;i--){
		if(total<b){
			total=total+arr[i];
			counter++;

		}

	}
	cout<<counter;

}


#include<bits/stdc++.h>
using namespace std;
int a, b, c, counter, total,arr[1010];
int main(){
	cin>>a;
	cin>>b;
	for(int i=0; i<a;i++){
		cin>>c;
		arr[i]=c;
	}
	sort(arr,arr+a);
	for(int i=a-1;i>=0;i--){
		if(total<b){
			total=total+arr[i];

			counter++;

		}

	}
	cout<<counter;

}


#include<bits/stdc++.h>
using namespace std;
int a, b, c, counter, total,arr[1010];
int main(){
	cin>>a;
	cin>>b;
	for(int i=0; i<a;i++){
		cin>>c;
		arr[i]=c;
	}
	sort(arr,arr+a);
	for(int i=a-1;i>=0;i--){
		if(total<b){
			total=total+arr[i];
			cout<<arr[i]<<" ini arr "<<i<<endl;
			counter++;

		}

	}
	cout<<counter;

}


//  from KTL
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
int a,aa,i,j,m,ans,s[1000000];
int main()
{
 	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin >> a >> m;
	for (i = 1; i <= a; i ++)
	{
		cin >> s [i];
	}
	sort (s + 1,s + a + 1);
	for (i = a; i >= 1; i --)
	{
		if (m <= 0)
		{
			cout << ans;return 0;
		}
		m -= s[i];
		ans ++;
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int n, a[100010], x, ans;
int main()
{
 	cin >> n;
	for (int i = 1;i <= n;i ++)
	{
		cin >> a[i];
	}
	sort (a + 1, a + n + 1);
	for (int i = n;i >= 1;i --)
	{
		if (ans <= 0)
		{
			cout << ans;
			return 0;
		}
		ans -= a[i];
		x ++;
	}
	 cout << x;
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int n, a[100010], x, ans;
int main()
{
 	cin >> n >> x;
	for (int i = 1;i <= n;i ++)
	{
		cin >> a[i];
	}
	sort (a + 1, a + n + 1);
	for (int i = n;i >= 1;i --)
	{
		x -= a[i];
		ans ++;
	}
	 cout << x;
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int n, a[100010], x, ans;
int main()
{
 	cin >> n >> x;
	for (int i = 1;i <= n;i ++)
	{
		cin >> a[i];
	}
	sort (a + 1, a + n + 1);
	for (int i = n;i >= 1;i --)
	{
		if (x <= 0)
		{
			cout << ans;
			return 0;
		}
		x -= a[i];
		ans ++;
	}
	 cout << x;
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std ;

void Merge(int* A, int*L, int LeftCount,int*R, int RightCount){

        int i,j,k ;
        //i - to mark the index of the Left Sub-array
        //j - to mark the index of the Right Sub-array
        //k -to mark the index of the merged Sub-array

        i=0 ; j=0 ; k=0 ;

        while (i<LeftCount && j<RightCount){

            if(L[i] < R[j]) A[k++] = L[i++] ;
            else A[k++] = R[j++] ;
        }

        while (i<LeftCount) A[k++] = L[i++] ;
        while (j<RightCount) A[k++] = R[j++] ;

}

void MergeSort(int *A, int n){

    int mid, i , *L, *R ;
    if (n < 2) return ; // base condition : if the array has two element, do nothing

    mid = n/2 ; // find the mid-index

    // create left and right sub_arrays
    // mid elements(from index 0 till mid-1) should be part of left sub array
    // and (n-mid) elements (from mid to n-1) should be a part of the right sub- array

    L = (int*)malloc(mid*sizeof(int)) ;
    R = (int*)malloc(mid*sizeof(int)) ;

    for (i=0 ; i<mid ; i++) L[i] = A[i] ;//creating left sub array
    for (i=mid ; i<n ; i++) R[i-mid] = A[i] ;// creating right sub array

    MergeSort(L, mid) ; // sorting the left sub array
    MergeSort(R, n-mid) ;// sorting the right sub array
    Merge(A, L , mid , R, n-mid) ; // Merging L and R into A as sorted list
    free(L) ;
    free(R) ;
}

int main(){

    int n ; cin >> n;
    int m ; cin >> m ;
    int array[n] ;
    for(int k = 0 ; k<n  ; k++){
        cin >> array[k] ;
    }

    MergeSort(array , n) ;

    int sum = 0, count =0 ;
    for (int i = n-1 ; i>=0 ; i--){
        sum = sum + array[i] ;
        count ++ ;

        if(sum >= m){
            cout << count << endl ;
            break ;
        }

    }

return 0 ;
}


#include <iostream>
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std ;

int main(){

    int n ; cin >> n;
    int m ; cin >> m ;
    int array[n] ;
    for(int k = 0 ; k<n  ; k++){
        cin >> array[k] ;
    }

    sort(array , array+n) ;

    int sum = 0, count =0 ;
    for (int i = n-1 ; i>=0 ; i--){
        sum = sum + array[i] ;
        count ++ ;

        if(sum >= m){
            cout << count << endl ;
            break ;
        }

    }

return 0 ;
}


#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std ;

void Merge(int* A, int*L, int LeftCount,int*R, int RightCount){

        int i,j,k ;
        //i - to mark the index of the Left Sub-array
        //j - to mark the index of the Right Sub-array
        //k -to mark the index of the merged Sub-array

        i=0 ; j=0 ; k=0 ;

        while (i<LeftCount && j<RightCount){

            if(L[i] < R[j]) A[k++] = L[i++] ;
            else A[k++] = R[j++] ;
        }

        while (i<LeftCount) A[k++] = L[i++] ;
        while (j<RightCount) A[k++] = R[j++] ;

}

void MergeSort(int *A, int n){

    int mid, i , *L, *R ;
    if (n < 2) return ; // base condition : if the array has two element, do nothing

    mid = n/2 ; // find the mid-index

    // create left and right sub_arrays
    // mid elements(from index 0 till mid-1) should be part of left sub array
    // and (n-mid) elements (from mid to n-1) should be a part of the right sub- array

    L = (int*)malloc(mid*sizeof(int)) ;
    R = (int*)malloc(mid*sizeof(int)) ;

    for (i=0 ; i<mid ; i++) L[i] = A[i] ;//creating left sub array
    for (i=mid ; i<n ; i++) R[i-mid] = A[i] ;// creating right sub array

    MergeSort(L, mid) ; // sorting the left sub array
    MergeSort(R, n-mid) ;// sorting the right sub array
    Merge(A, L , mid , R, n-mid) ; // Merging L and R into A as sorted list
    free(L) ;
    free(R) ;
}

int main(){

    int n ; cin >> n;
    int m ; cin >> m ;
    int array[n] ;
    for(int k = 0 ; k<n  ; k++){
        cin >> array[k] ;
    }

    MergeSort(array , n) ;

    int sum = 0, count =0 ;
    for (int i = n-1 ; i>=0 ; i--){
        sum = sum + array[i] ;
        count ++ ;

        if(sum >= m){
            cout << count << endl ;
            break ;
        }

    }

return 0 ;
}


#include<iostream>
#include<string.h>
using namespace std;
int n;
int s[500];
int memo[100][100];
int m;
int solve(int i,int op)
{

    if(i==n&&m<=0)
        return op;
    if(m<=0)
        if(op==0)
            return 1000000000;
        else
            return op;
    if(i==n)
        return 100000000;
    if(memo[i][op]!=-1)
        return memo[i][op];
    int m1=0,n1=0;
    m-=s[i];
    m1=solve(i+1,op+1);
    m+=s[i];
    n1=solve(i+1,op);
    return memo[i][op]=min(m1,n1);
}
int main()
{
    cin>>n;
    cin>>m;
    memset(memo,-1,sizeof(memo));
    for(int i=0; i<n; i++)
        cin>>s[i];
    cout<<solve(0,0);

}


#include<iostream>
#include<string.h>
using namespace std;
int n;
int s[500];
int memo[105][105];
int m;
int solve(int i,int op)
{
    if(i==n&&m<=0)
        return op;
    if(m<=0)
        return op;
    if(i==n)
        return 100000000;
    if(memo[i][op]!=-1)
        return memo[i][op];
    int m1=0,n1=0;
    m-=s[i];
    m1=solve(i+1,op+1);
    m+=s[i];
    n1=solve(i+1,op);
    return memo[i][op]=min(m1,n1);
}
int main()
{
    cin>>n;
    cin>>m;
memset(memo,-1,sizeof(memo));
    for(int i=0;i<n;i++)
        cin>>s[i];
    cout<<solve(0,0);

}


#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;

int main()
{
    int n,m;
    cin>>n;
    cin>>m;
    int s[n];
    for(int i=0; i<n; i++)
        cin>>s[i];
    sort(s,s+n);
    int res=0;
    for(int i=n-1;i>=0;i--)
        if(m<=0)
            break;
        else {m-=s[i];
        res++;
        }
    cout<<res;

}


#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=102;
int a[maxn];
int main()
{
    int n,m,sum=0,sum1=0;
    cin>>n>>m;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    while(sum<=m)
    {
        sum+=a[n];
        sum1++;
        n--;
    }
    cout<<sum1;
}


#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=102;
int a[102];
int n,m,sum=0,sum1=0;
int main()
{
    cin>>n>>m;
    int j=n-1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    while(sum>=m)
    {
        sum+=a[j];
        sum1++;
        j--;
    }
    cout<<sum1;
}


#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=102;
int a[maxn];
int main()
{
    int n,m,sum=0,sum1=0;
    cin>>n>>m;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    while(sum<=m)
    {
        sum+=a[n];
        sum1++;
        n--;
    }
    cout<<sum1-1;
}


#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=102;
int a[maxn];
int main()
{
    int n,m,sum=0,sum1=0;
    cin>>n>>m;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    while(sum<m)
    {
        sum+=a[n];
        sum1++;
        n--;
    }
    cout<<sum1;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int a[100000];

int n,m;

int main() {
	///freopen("a.in", "r", stdin);
	scanf("%d %d", &n, &m);
	for(int i = 0; i < n; i ++) scanf("%d", &a[i]);
	sort(a, a + n);
	int i;
	int sum = 0;
	for(i = n - 1; i >= 0; i --) {
		sum += a[i];
		if(sum >= m) break;
	}
	printf("%d\n", n - i);
}


#include <cstdio>
#include <algorithm>

using namespace std;

#define N 110

int n, m, a[N];

int main() {
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = n - 1; i >= 0; i --) {
        m -= a[i];
        if(m <= 0) {
            printf("%d\n", n - i);
        return 0;
        }
    }
    return 0;
}