#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e18;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k%vec[i]==0) s = k/vec[i];
        }
        int mx = *max_element(vec.begin(), vec.end());
        if(mx >= k){
            cout << min(s, 2LL) << endl;
        }else{
            cout << min(s, k/mx+bool(k%mx)) << endl;
        }
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e18;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k%vec[i]==0) s = k/vec[i];
        }
        int mx = *max_element(vec.begin(), vec.end());
        if(mx > k){
            cout << min(s, 2LL) << endl;
        }else{
            double c = (double)k/2;
            cout << min(s, (int)ceil(c/mx)*2) << endl;
        }
    }
}


#include <bits/stdc++.h>
#define author_by_CutieRabbit cin.tie(0); ios::sync_with_stdio(false);
#define int long long
using namespace std;

int32_t main() {
    author_by_CutieRabbit
    int T;
    cin >> T;
    while(T--){
        int n, k;
        cin >> n >> k;
        vector<int> vec(n);
        int s = 1e9;
        for(int i = 0; i < n; i++){
            cin >> vec[i];
            if(k%vec[i]==0) s = k/vec[i];
        }
        int mx = *max_element(vec.begin(), vec.end());
        cout << min(s, max((int)ceil((double)k/mx),2LL)) << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (M != 0 && M + arr[N] < (arr[N] * 2)) {
			ans--;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		for (int i = 1; i <= N; ++i) cin >> arr[i];
		sort(arr + 1, arr + N + 1);
		int t = M - arr[1];
		ans += t / arr[N];
		if (t % arr[N] != 0) ++ans;
		cout << ans + 1 << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		bool flag = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
			if (arr[i] == M) flag = 1;
		}
		if (flag) {
			cout << 1 << "\n";
			continue;
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (v != 0 && M != 0 && M + arr[N] < (arr[N] * 2)) {
			ans--;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		bool flag = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
			if (arr[i] == M) flag = 1;
		}
		if (flag) {
			cout <<1<<"\n":
			continue;
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (v != 0 && M != 0 && M + arr[N] < (arr[N] * 2)) {
			ans--;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (M != 0 && M + arr[N] < (arr[N] * 2)) {
			ans -= v;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (v != 0 && M != 0 && M + arr[N] < (arr[N] * 2)) {
			ans--;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 1;
		for (int i = 1; i <= N; ++i) cin >> arr[i];
		sort(arr + 1, arr + N + 1);
		if (M % arr[N] == 0) {
			cout << M / arr[N] << "\n";
			continue;
		}
		int t = M - arr[1];
		ans += t / arr[N];
		if (t % arr[N] != 0) ++ans;
		cout << ans<< "\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
int TC, N, M, arr[200005];
set<int> st;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> TC;
	while (TC--) {
		cin >> N >> M;
		int ans = 0;
		for (int i = 1; i <= N; ++i) {
			cin >> arr[i];
		}
		sort(arr + 1, arr + N + 1);
		int v = (M / (arr[N]* 2));
		ans += (v * 2);
		M -= arr[N] * (v * 2);
		if (M + arr[N] < (arr[N] * 2)) {
			ans -= v;
			M += arr[N];
		}
		if (M == 0) ans = ans;
		else if (M == arr[N]) ++ans;
		else ans += 2;
		cout << ans << "\n";
	}
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	int n,d,i,x;
	cin>>n>>d;
	set<int>s;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);
	}

	float maxm=*s.rbegin();
	int y=ceil(d/maxm);
	int ans=max(2,y);
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	int n,d,i,x,ans;
	cin>>n>>d;
	set<int>s;
	map<int,int>m;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);
		m[x]++;
	}

	float maxm=*s.rbegin();
	int y=ceil(d/maxm);
	if(m[d])
		ans=1;
	else
		ans=max(2,y);
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	long long int n,d,i,x,ans,y;
	cin>>n>>d;
	set<int>s;
	map<int,int>m;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);

	}

	int maxm=*s.rbegin();
	if(d/maxm==0)
	{
	y=d/maxm;
	}
	else
		y=d/maxm+1;
	cout<<y<<endl;
	if(s.count(d))
		ans=1;
	else
		{
			if(y>2)
				ans=y;
			else
				ans=2;
		}
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	int n,d,i,x,ans;
	cin>>n>>d;
	set<int>s;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);
	}

	float maxm=*s.rbegin();
	int y=ceil(d/maxm);
	if(d/maxm==1)
		ans=1;
	else
		ans=max(2,y);
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	long long int n,d,i,x,ans,y;
	cin>>n>>d;
	set<int>s;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);

	}

	int maxm=*s.rbegin();
	if(d/maxm==0)
	{
	y=d/maxm;
	}
	else
		y=d/maxm+1;
	if(s.count(d))
		ans=1;
	else
		{
			if(y>2)
				ans=y;
			else
				ans=2;
		}
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	int n,d,i,x,ans;
	cin>>n>>d;
	set<int>s;
	map<int,int>m;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);
		m[x]++;
	}

	float maxm=*s.rbegin();
	int y=ceil(d/maxm);
	if(m[x])
		ans=1;
	else
		ans=max(2,y);
	cout<<ans<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include <cmath>
#include<map>
#include<set>
using namespace std;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out1.txt","w",stdout);
	#else
    #endif
	int t;
	cin>>t;
	while(t--)
	{
	long long int n,d,i,x,ans,y;
	cin>>n>>d;
	set<int>s;
	for(i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);

	}

	int maxm=*s.rbegin();
	if(d%maxm==0)
	{
	y=d/maxm;
	}
	else
		y=d/maxm+1;
	if(s.count(d))
		ans=1;
	else
		{
			if(y>2)
				ans=y;
			else
				ans=2;
		}
	cout<<ans<<endl;
	}

	return 0;
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			mp[a[i]]++;
		}
		for (long long i=1; i<=n; i++)
		{
			ans=x/a[i];
			if (x%a[i]!=0)
			{
			ans++;
			if (mp[x%a[i]]==0)
			ans++;
			}
			ans1=min(ans1,ans);
		}
		cout<<ans1<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		long long bb=2;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			if (a[i]==x) ans1=1;
			if (a[i]>x) ans1=min(ans1,bb);
		}
		if (ans1==1)
		{
		     cout<<1<<endl;
		     continue;
		}
		for (long long i=1; i<=n; i++)
		{
			ans=x/a[i];
			if (x%a[i]!=0)
			{
			ans++;
			}
			ans1=min(ans1,ans);
		}
		cout<<max(ans1,bb)<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			if (a[i]==x) ans1=1;
			mp[a[i]]++;
		}
		long long bb=2;
		ans1=min(ans1,bb);
		for (long long i=1; i<=n; i++)
		{
			ans=x/a[i];
			if (x%a[i]!=0)
			{
			ans++;
			}
			ans1=min(ans1,ans);
		}
		cout<<ans1<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1,mx;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		ans=1e9;
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			mx=max(mx,a[i]);
			if (a[i]==x) ans=1;
			mp[a[i]]++;
		}
		if (ans==1)
		{
			cout<<1<<endl;
			continue;
		}
		long long bb=2;
	if (mx>x)
	ans=min(ans,bb);
	else
	ans=min(ans,(x+mx-1)/mx);
		cout<<ans<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1,mx;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		ans=1e9;
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			mx=max(mx,a[i]);
			if (a[i]==x) ans=1;
			mp[a[i]]++;
		}
		long long bb=2;
	if (mx>x)
	ans=min(ans,bb);
	else
	ans=min(ans,(x+mx-1)/mx);
	cout<<ans<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1,mx;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		ans=2e9;
		mx=-1e9;
		mp.clear();
		cin>>n>>x;
		ans1=2e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			mx=max(mx,a[i]);
			if (a[i]==x) ans=1;
		}
		long long bb=2;
	if (mx>x)
	ans=min(ans,bb);
	else
	ans=min(ans,(x+mx-1)/mx);
	cout<<ans<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			mp[a[i]]++;
		}
		for (long long i=1; i<=n; i++)
		{
			ans=x/a[i];
			if (x%a[i]!=0)
			{
			ans++;
			}
			ans1=min(ans1,ans);
		}
		cout<<ans1<<endl;
	}
}


# include <bits/stdc++.h>
using namespace std;
long long n,d,a[200005],ans,t,w,x,b,ans1;
map <long long, long long> mp;
int main()
{
	cin>>t;
	while (t--)
	{
		mp.clear();
		cin>>n>>x;
		ans1=1e9;
		long long bb=2;
		for (long long i=1; i<=n; i++)
		{
			cin>>a[i];
			if (a[i]==x) ans1=1;
			if (a[i]>x) ans1=min(ans1,bb);
		}
		for (long long i=1; i<=n; i++)
		{
			ans=x/a[i];
			if (x%a[i]!=0)
			{
			ans++;
			}
			ans1=min(ans1,ans);
		}
		cout<<ans1<<endl;
	}
}


	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define add push_back

	int main (){
		int t; cin >> t;
		while(t--){
			int n,x; cin >> n >> x;
			vector<int> v(n);
			int mx = -1;
			map<int,bool> g;
			for (int i = 0; i < n; i++){
				cin>> v[i];
				mx = max(v[i], mx);
				g[v[i]] = 1;
			}
			sort(v.begin(), v.end());
			ll mn = 1000000000;
			if (g[x] == 1){
				cout << 1 << endl;
				continue;
			}
			if (x % mx == 0){
				cout << x / mx << endl;
				continue;
			}
			if (mx >= (double)x / 2){
				cout << 2 << endl;
				continue;
			}
			cout << (x / mx) + 1 << endl;
		}
		return 0;
	}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define add push_back

int main (){
	int t; cin >> t;
    while(t--){
		int n,x; cin >> n >> x;
		vector<int> v(n);
		int mx = -1;
		map<int,bool> g;
		for (int i = 0; i < n; i++){
			cin>> v[i];
			mx = max(v[i], mx);
			g[v[i]] = 1;
		}
		sort(v.begin(), v.end());
		ll mn = 1000000000;
		for (int i = 0; i < n; i++){
			int f = v[i];
			int m = x / f;
			if (x % f == 0){
				m = m;
			}else{
				if (g[x % f] == 1){
					m++;
				}else{
					m += 2;
				}
			}
			mn = min(m,mn);
		}
		cout << mn << endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define add push_back

int main (){
	int t; cin >> t;
    while(t--){
		int n,x; cin >> n >> x;
		vector<int> v(n);
		int mx = -1;
		map<int,bool> g;
		for (int i = 0; i < n; i++){
			cin>> v[i];
			mx = max(v[i], mx);
			g[v[i]] = 1;
		}
		sort(v.begin(), v.end());
		ll mn = 1000000000;
		for (int i = 0; i < n; i++){
			ll f = v[i];
			ll m = x / f;
			if (x % f == 0){
				m = m;
			}else{
				if (g[x % f] == 1){
					m++;
				}else{
					m += 2;
				}
			}
			mn = min(m,mn);
		}
		cout << mn << endl;
    }
	return 0;
}


	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define add push_back

	int main (){
		int t; cin >> t;
		while(t--){
			int n,x; cin >> n >> x;
			vector<int> v(n);
			int mx = -1;
			map<int,bool> g;
			for (int i = 0; i < n; i++){
				cin>> v[i];
				mx = max(v[i], mx);
				g[v[i]] = 1;
			}
			sort(v.begin(), v.end());
			ll mn = 1000000000;
			if (g[x] == 1){
				cout << 1 << endl;
				continue;
			}
			if (mx % x == 0){
				cout << x / mx << endl;
				continue;
			}
			if (mx >= (double)x / 2){
				cout << 2 << endl;
				continue;
			}
			cout << (x / mx) + 1 << endl;
		}
		return 0;
	}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define add push_back

int main (){
	int t; cin >> t;
    while(t--){
		int n,x; cin >> n >> x;
		vector<int> v(n);
		int mx = -1;
		map<int,bool> g;
		for (int i = 0; i < n; i++){
			cin>> v[i];
			mx = max(v[i], mx);
			g[v[i]] = 1;
		}
		sort(v.begin(), v.end());
		int mn = 100000;
		for (int i = 0; i < n; i++){
			int f = v[i];
			int m = x / f;
			if (x % f == 0){
				m = m;
			}else{
				if (g[x % f] == 1){
					m++;
				}else{
					m += 2;
				}
			}
			mn = min(m,mn);
		}
		cout << mn << endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define add push_back

int main (){
	int t; cin >> t;
    while(t--){
		int n,x; cin >> n >> x;
		vector<int> guys(n);
		for (int i = 0; i < n; i++){
			cin>> guys[i];
		}
		map<int,bool> used;
		queue<pair<int,int> > q;
		q.push(make_pair(0,0));
		set<int> answers;
		while(!q.empty()){
			pair<int,int> curr = q.front();
			q.pop();
			if (curr.first == x){
				answers.insert(curr.second);
				continue;
			}
			used[curr.first] = 1;
			for (int i = 0; i < n; i++){
				int guy = guys[i];
				if (curr.first + guy <= x && !used[curr.first + guy]){
					q.push(make_pair(curr.first + guy, curr.second + 1));
				}
				guy--;
				while(guy > 0){
					int p = guy * 2;
					if (curr.first + p <= x && !used[curr.first + p]){
						q.push(make_pair(curr.first + p, curr.second + 2));
					}
					guy--;
				}
			}
		}
		cout << *answers.begin() << endl;

    }
	return 0;
}


	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define add push_back

	int main (){
		int t; cin >> t;
		while(t--){
			int n,x; cin >> n >> x;
			vector<int> v(n);
			int mx = -1;
			map<int,bool> g;
			for (int i = 0; i < n; i++){
				cin>> v[i];
				mx = max(v[i], mx);
				g[v[i]] = 1;
			}
			ll mn = 1000000000;
			if (g[x] == 1){
				cout << 1 << endl;
				continue;
			}
			if (x % mx == 0){
				cout << x / mx << endl;
				continue;
			}
			if (mx >= x / 2){
				cout << 2 << endl;
				continue;
			}
			cout << (x / mx) + 1 << endl;
		}
		return 0;
	}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define add push_back

int main (){
	int t; t = 1;
    while(t--){
       string s; cin >> s;
	   map<char,int> seq;
	   for (int i = 0; i < s.length(); i++){
		   seq[s[i]]++;
	   }
	   ll mx1 = 1;
	   ll mx2 = 1;
	   ll asad;
	   for (auto it = seq.begin(); it != seq.end(); it++){
		   int guy = it->second;
		   if (guy >= mx1){
			   mx2 = mx1;
			   mx1 = guy;
			   continue;
		   }
		   if (guy > mx2){
			   mx2 = guy;
			   continue;
		   }
	   }
	   ll mn;
	   if (mx1 % 2 == 0)
	   		mn = mx1 / 2;
		else
			mn = (mx1 - 1) / 2;
	   cout << mx1 * max(mx2,mn) << endl;
    }
	return 0;
}


	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define add push_back

	int main (){
		int t; cin >> t;
		while(t--){
			int n,x; cin >> n >> x;
			vector<int> v(n);
			int mx = -1;
			map<int,bool> g;
			for (int i = 0; i < n; i++){
				cin>> v[i];
				mx = max(v[i], mx);
				g[v[i]] = 1;
			}
			sort(v.begin(), v.end());
			ll mn = 1000000000;
			if (g[x] == 1){
				cout << 1 << endl;
				continue;
			}
			if (mx % x == 0){
				cout << x / mx << endl;
				continue;
			}
			if (mx >= x / 2){
				cout << 2 << endl;
				continue;
			}
			cout << (x / mx) + 1 << endl;
		}
		return 0;
	}


	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long
	#define add push_back

	int main (){
		int t; cin >> t;
		while(t--){
			int n,x; cin >> n >> x;
			vector<int> v(n);
			int mx = -1;
			map<int,bool> g;
			for (int i = 0; i < n; i++){
				cin>> v[i];
				mx = max(v[i], mx);
				g[v[i]] = 1;
			}
			sort(v.begin(), v.end());
			ll mn = 1000000000;
			if (g[x] == 1){
				cout << 1 << endl;
				continue;
			}
			if (mx % x == 0){
				cout << mx / x << endl;
				continue;
			}
			cout << (mx / x) + 1 << endl;
		}
		return 0;
	}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 1e9;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          //ma =max(ma,num[i]);
      }
      for(int i = 1;i<=n;++i)
      {
          LL tmp = x/(2*num[i])*2;
          if(x%(2*num[i])!=0)
          {
              if(tmp==0)
              {
                  if(s.find(x%(2*num[i]))!=s.end())
                        tmp=1;
                    else
                   tmp = 2;
              }

              else
              {
                if(x%(2*num[i])>num[i])
                {
                    if(s.find(x%(2*num[i]))!=s.end())
                        ++tmp;
                    else
                        tmp+=2;
                }
                else
                {
                    ++tmp;
                }
              }

          }
          ans = min(ans,tmp);
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 1e9;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          //ma =max(ma,num[i]);
      }
      for(int i = 1;i<=n;++i)
      {
          LL tmp = x/(2*num[i])*2;
          if(x%(2*num[i])!=0)
          {
              if(s.find(x%(2*num[i]))!=s.end())
                ++tmp;
              else
                tmp+=2;
          }
          ans = min(ans,tmp);
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 1e9;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
    if(s.find(x)!=s.end())
    {
        ans = 1;
    }
    else
    {
        ans = x/ma;
        if(ans==0)
            ans = 2;
        else
        {
            ++ans;
        }
    }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 0;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
     // LL ans = 0;
    // cout << "ma  = " << ma << "\n";
      if(s.find(x)!=s.end())
      {
          ans = 1;
      }
      else
      {
          if(x<=2*ma)
                ans = 2;
          else
          {
              ans = x/ma;
              if(x%ma)
              ++ans;
          }
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 1e9;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          //ma =max(ma,num[i]);
      }
      for(int i = 1;i<=n;++i)
      {
          LL tmp = x/(2*num[i])*2;
          if(x%(2*num[i])!=0)
          {
              if(s.find(x%(2*num[i]))!=s.end())
                ++tmp;
              else
                tmp+=2;
          }
          ans = min(ans,tmp);
      }
      for(int i = 1;i<=n;++i)
      {
        LL tmp = x/(num[i]);
          if(x%(num[i])!=0)
          {
              if(s.find(x%(num[i]))!=s.end())
                ++tmp;
              else
                tmp+=2;
          }
          ans = min(ans,tmp);
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 1e9;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          //ma =max(ma,num[i]);
      }
      for(int i = 1;i<=n;++i)
      {
          LL tmp = x/(num[i]);
          if(x%(num[i])!=0)
          {
              if(s.find(x%(num[i]))!=s.end())
                ++tmp;
              else
                tmp+=2;
          }
          ans = min(ans,tmp);
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 0;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
     // LL ans = 0;
    // cout << "ma  = " << ma << "\n";
      if(s.find(x)!=s.end())
      {
          ans = 1;
      }
      else
      {
          if(x<=2*ma)
                ans = 2;
          else
          {
              ans = x/ma;
              if(x%ma);
              ++ans;
          }
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
     LL ans = 0;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
     // LL ans = 0;
    // cout << "ma  = " << ma << "\n";
      if(s.find(x)!=s.end())
      {
          ans = 1;
      }
      else
      {
          while(x)
          {
              if(x<=2*ma)
              {
                  ans+=2;
                  break;
              }
              x-=ma;
              ++ans;
          }
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
      bool flag = false;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
      LL ans = x/(2*ma);
      x%=(2*ma);
      if(x==0)
      {
          cout << ans << "\n";
          continue;
      }
      if(s.find(x)!=s.end())
        ++ans;
      else
        ans+=2;
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
      bool flag = false;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
      LL ans = x/(2*ma);
      x%=(2*ma);
      if(s.find(x)!=s.end())
        ++ans;
      else
        ans+=2;
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;
LL num[maxn];
set<LL> s;
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        s.clear();
      LL n,x;
      cin >> n >>x;
      LL ma = 0;
      bool flag = false;
      for(int i =1;i<=n;++i )
      {
          cin >> num[i];
          if(num[i]==x)
          {
              flag = true;
          }
          s.insert(num[i]);
          ma =max(ma,num[i]);
      }
      LL ans = 0;
      while(x>0)
      {
          if(s.find(x)!=s.end())
          {
              x = 0;
              ++ans;
              break;
          }
          if(x<=2*ma)
          {
              ans+=2;
              break;
          }
          x-=ma;
          ++ans;
      }
      cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
map <int,int> ma;
bool cmp(int a, int b) {
    return a > b;
}
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        ma.clear();
        for(int i = 1 ; i <= n ; i ++) {
            cin >> num[i];
            ma[num[i]] = 1;
        }
        sort(num+1,num+1+n,cmp);
        if(ma[m] == 1)
            cout<<1<<endl;
        else
        {
            if(num[1] <= m)
                cout << (m / num[1]) + bool(m % num[1]) << endl;
            else
                cout<<2<<endl;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
map <int,int> ma;
bool cmp(int a, int b) {
    return a > b;
}
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        ma.clear();
        for(int i = 1 ; i <= n ; i ++) {
            cin >> num[i];
            ma[num[i]] = 1;
        }
        sort(num+1,num+1+n,cmp);
        if(ma[m] == 1)
            cout<<1<<endl;
        else
        {
            if(num[1]*2 >= m)
                cout<<2<<endl;
            else
                cout<<(m/num[1]-1)+2<<endl;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
map <int,int> ma;
bool cmp(int a, int b) {
    return a > b;
}
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        ma.clear();
        for(int i = 1 ; i <= n ; i ++) {
            cin >> num[i];
            ma[num[i]] = 1;
        }
        sort(num+1,num+1+n,cmp);
        if(ma[m] == 1)
            cout<<1<<endl;
        else
            cout<<(m/num[1]-1)+2<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
ll n, m;
ll num[100005];
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        for(int i = 1 ; i <= n ; i ++)
            cin>>num[i];
        ll ans = INF;
        for(int i = 1 ; i <= n ; i ++)
        {
            if((m % num[i]) == 0)
                ans = min(ans,m/num[i]);
            else
            {
                if(m <= 2*num[i])
                    ans = min((ll)2,ans);
                else
                    ans = min(ans,((m/num[i])+1)*2);
            }
        }
        cout<<ans<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
ll n, m;
ll num[100005];
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        for(int i = 1 ; i <= n ; i ++)
            cin>>num[i];
        ll ans = INF;
        for(int i = 1 ; i <= n ; i ++)
        {
            if((m % num[i]) == 0)
                ans = min(ans,m/num[i]);
            else
            {
                if(m <= 2*num[i])
                    ans = min((ll)2,ans);
                else
                    ans = min(ans,(m / num[i])+(ll)2);
            }
        }
        cout<<ans<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        for(int i = 1 ; i <= n ; i ++)
            cin>>num[i];
        int ans = INF;
        for(int i = 1 ; i <= n ; i ++)
        {
            if((m % num[i]) == 0)
                ans = min(ans,m/num[i]);
            else
            {
                if(m <= 2*num[i])
                    ans = min(2,ans);
                else
                    ans = min(ans,(m / num[i])+2);
            }
        }
        cout<<ans<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
map <int,int> ma;
bool cmp(int a, int b) {
    return a > b;
}
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        ma.clear();
        for(int i = 1 ; i <= n ; i ++) {
            cin >> num[i];
            ma[num[i]] = 1;
        }
        sort(num+1,num+1+n,cmp);
        if(ma[m] == 1)
            cout<<1<<endl;
        else
        {
            if(num[1]*2 >= m)
                cout<<2<<endl;
            else
            {
                int ans = INF;
                for(int i = 1 ; i <= n ; i ++) {
                    if (m % num[i] == 0)
                        ans = min(ans,m/num[i]);
                    else
                    {
                        if (ma[m % num[i]] == 1)
                            ans = min(ans,m/num[i]+1);
                        else
                            ans = min(ans,m/num[i]+2);
                    }
                }
                cout<<ans<<endl;
            }
        }
    }
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define p_queue priority_queue

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
int T;
int n, m;
int num[100005];
map <int,int> ma;
bool cmp(int a, int b) {
    return a > b;
}
int main(void)
{
    cin>>T;
    while(T --)
    {
        cin>>n>>m;
        for(int i = 1 ; i <= n ; i ++) {
            cin >> num[i];
            ma[num[i]] = 1;
        }
        sort(num+1,num+1+n,cmp);
        if(ma[m] == 1)
            cout<<1<<endl;
        else
        {
            if(num[1]*2 >= m)
                cout<<2<<endl;
            else
            {
                int ans = INF;
                for(int i = 1 ; i <= n ; i ++) {
                    if (m % num[i] == 0)
                        ans = min(ans,m/num[i]);
                    else
                    {
                        if (ma[m % num[i]] == 1)
                            ans = min(ans,m/num[i]+1);
                        else
                            ans = min(ans,m/num[i]+2);
                    }
                }
                cout<<ans<<endl;
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z;
        for(ll i=0;i<n;i++){
            cin>>a[i];
            if(a[i]==x){
                ans=1;
            }else if(a[i]>x){
                ans=2;
            }else{
                z=x/a[i];
                z++;
                ans=min(ans,z);
            }
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z;
        for(ll i=0;i<n;i++){
            cin>>a[i];
        }
        sort(a, a+n);
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans=1;
                break;
            }else{
                z=x/a[i];
                if(z<2)ans=2;
                else{
                    ans=min(ans,z+1);
                }
            }
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z=INT_MIN;
        for(ll i=0;i<n;i++){
            cin>>a[i];
        }
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans=1;
                break;
            }
            z=max(z, a[i]);
        }
        if(ans!=1){
            ans=x/z;
            if(ans<2)ans=2;
            else if(x%z!=0)ans++;
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z=INT_MIN;
        for(ll i=0;i<n;i++){
            cin>>a[i];
        }
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans=1;
                break;
            }
            z=max(z, a[i]);
        }
        if(ans!=1){
            ans=x/z;
            if(ans<=2)ans=2;
            else if(x%z!=0)ans++;
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z;
        for(ll i=0;i<n;i++){
            cin>>a[i];
            if(a[i]==x){
                ans=1;
            }else if(a[i]>x){
                ans=2;
            }else{
                z=x/a[i];
                if(x%a[i]!=0)z++;
                ans=min(ans,z);
            }
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z=INT_MIN;
        for(ll i=0;i<n;i++){
            cin>>a[i];
        }
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans=1;
                break;
            }
            z=max(z, a[i]);
        }
        if(ans!=1){
            ans=x/z;
            ans++;
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z;
        for(ll i=0;i<n;i++){
            cin>>a[i];
            if(a[i]==x){
                ans=1;
            }else if(a[i]>x){
                ans=2;
            }else{
                z=x/a[i];
                //if(x%a[i]!=0)z++;
                ans=min(ans,z);
            }
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// Right Arrow
ostream &ra(ostream &stream)
{
    stream << " ------->";
    return stream;
}
int main(int argc, char *argv[])
{
    fastIO //for fast input/output

    ll t;
    cin>>t;
    ll n, x;
    while(t--){
        cin>>n>>x;
        ll a[n], ans=INT_MAX, z;
        for(ll i=0;i<n;i++){
            cin>>a[i];
        }
        sort(a, a+n);
        for(int i=0;i<n;i++){
            if(a[i]==x){
                ans=1;
                break;
            }else{
                z=x/a[i];
                if(z<2)ans=2;
                else{
                    ans=z+1;
                }
            }
        }
        cout<<ans;
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=1;i<n+1;i++)
		{
			if(i>1&&sum[i]>=x)
			{
				cout<<i<<"\n";
				break;
			}

		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
			cout<<ceil(x/sum[i-1])<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		if(n==1)
		{
			int r=ceil(x/a[0]);
			cout<<r<<"\n";
			continue;
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
		   int y=ceil((x*n*1.0)/(sum[i-1]*1.0));
		   cout<<y<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		if(n==1)
		{
			if(a[0]>x)
			cout<<2<<"\n";
			else
			{
				if(a[0]==1)
				cout<<1<<"\n";
				else
				{
					int r=ceil(x/a[0]);
					cout<<r<<"\n";
				}
			}
			continue;
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
		   int y=ceil((x*n*1.0)/(sum[i-1]*1.0));
		   cout<<y<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mod 1000000007
//#define mod 998244353
using namespace std;
ll power(ll x,ll n)
{
	ll res =1;
	while(n>0)
	{
		if(n%2==1)
	res=res*x;
	x=x*x;
	n=n/2;
	}
	return res;

}

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;

    cin>>t;
    while(t--){
    	ll n,x,i;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
		}
		sort(a,a+n,greater<int>());
		int flag=0;
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=1;
				break;
			}
		}
		if(flag==1)
		continue;
		if(x%a[0]==0)
		{
			cout<<x/a[0];
		}
		else
		{
			int ans=x/a[0] +1;
			if(ans==1)
			cout<<ans+1;
			else
			cout<<ans;
		}
		cout<<"\n";

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
		   int y=ceil((x*n*1.0)/(sum[i-1]*1.0));
		   cout<<y<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
			cout<<n*ceil(x/sum[i-1])<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i,flag=0;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=-1;
				break;
			}
		}
		if(flag==-1)
		continue;
		for(i=2;i<n+1;i++)
		{
			if(sum[i]>=x)
			{
				cout<<i<<"\n";
				flag=-1;
				break;
			}

		}
		if(flag==0)
		{
		   int y=ceil(x/sum[i-1]);
		   cout<<y*n<<"\n";
		}

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mod 1000000007
//#define mod 998244353
using namespace std;
ll power(ll x,ll n)
{
	ll res =1;
	while(n>0)
	{
		if(n%2==1)
	res=res*x;
	x=x*x;
	n=n/2;
	}
	return res;

}

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;

    cin>>t;
    while(t--){
    	ll n,x,i;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
		}
		sort(a,a+n,greater<int>());
		int flag=0;
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=1;
				break;
			}
		}
		if(flag==1)
		continue;
		ll sum=a[0];
		for(i=1;i<n;i++)
		{
			sum=sum+a[i];
			if(sum>=x)
			{
				break;
			}
		}
		cout<<i+1<<"\n";

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mod 1000000007
//#define mod 998244353
using namespace std;
ll power(ll x,ll n)
{
	ll res =1;
	while(n>0)
	{
		if(n%2==1)
	res=res*x;
	x=x*x;
	n=n/2;
	}
	return res;

}

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;

    cin>>t;
    while(t--){
    	ll n,x,i;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];
		}
		sort(a,a+n,greater<int>());
		int flag=0;
		for(i=0;i<n;i++)
		{
			if(a[i]==x)
			{
				cout<<1<<"\n";
				flag=1;
				break;
			}
		}
		if(flag==1)
		continue;
		if(x%a[n-1]==0)
		{
			cout<<x/a[n-1];
		}
		else
		{
			int ans=x/a[n-1] +1;
			if(ans==1)
			cout<<ans+1;
			else
			cout<<ans;
		}
		cout<<"\n";

	}

}


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
    	int n,x,i;
    	cin>>n>>x;
    	int a[n];
    	for(i=0;i<n;i++)
    	{
    		cin>>a[i];

		}
		sort(a,a+n);
	    ll sum[n+1]={0};
	    for(i=1;i<n+1;i++)
	    {
	    	sum[i]=sum[i-1]+a[n-i];
		}
		for(i=1;i<n+1;i++)
		{
			if(i>1&&sum[i]>=x)
			{
				cout<<i<<"\n";
				break;
			}
			else
			{
				if(i==1&&sum[i]==x)
				{
					cout<<i<<"\n";
					break;
				}
			}
		}

	}

}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            long long t;    cin >> t;
            if (t == d) {
                ans = min(ans, 1LL);
            }
            else if (t > d) {
                ans = min(ans, 2LL);
            }
            else {
                ans = min(ans, (long long)ceil(1.0 * d / t));
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
long long a[maxn];
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        multiset <long long> st;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];    st.insert(a[i]);
            if (d % a[i] == 0) {
                ans = min(ans, d / a[i]);
            }
            if (a[i] > d) {
                ans = min(ans, 2LL);
            }
        }
        sort(a + 1, a + 1 + n);
        if (a[n] < d) {
            long long now = max((d - 2 * a[n]) / a[n], 0LL);    d -= now * a[n];
            if (!d) ans = min(ans, now);
            else if (st.find(d) != st.end()) {
                ans = min(ans, now + 1);
            }
            else {
                for (int i = 1; i <= n; i++) {
                    if (st.find(d - a[i]) != st.end()) {
                        ans = min(ans, now + 2);
                    }
                }
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
long long a[maxn];
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        long long ans = 0, maxv = 0;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
            maxv = max(maxv, a[i]);
        }
        ans = (d - 1) / maxv + 1;
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
long long a[maxn];
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        multiset <long long> st;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];    st.insert(a[i]);
            if (d % a[i] == 0) {
                ans = min(ans, d / a[i]);
            }
            if (a[i] > d) {
                ans = min(ans, 2LL);
            }
        }
        sort(a + 1, a + 1 + n);
        if (ans > 2) {
            long long now = (d - a[1]) / a[n];
            for (int i = 1; i <= n; i++) {
                if (st.find(d - now * a[n] - a[i]) != st.end()) {
                    ans = min(ans, now + 2);
                }
                if (st.find(d - now * a[n]) != st.end()) {
                    ans = min(ans, now + 1);
                }
            }
            ans = min(ans, d / a[n] + (d - d / a[n] == 0 ? 0 : 2));

        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            long long t;    cin >> t;
            if (t == d) {
                ans = 1;
                break;
            }
            else if (t > d) {
                ans = min(ans, 2LL);
            }
            else {
                ans = min(ans, (long long)ceil(1.0 * d / t));
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            long long t;    cin >> t;
            if (t == d) {
                ans = 1;
                break;
            }
            else if (t > d) {
                ans = min(ans, 2LL);
            }
            else {
                ans = min(ans, (d - 1) / t + 1);
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
long long a[maxn];
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        multiset <long long> st;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];    st.insert(a[i]);
            if (d % a[i] == 0) {
                ans = min(ans, d / a[i]);
            }
            if (a[i] > d) {
                ans = min(ans, 2LL);
            }
        }
        sort(a + 1, a + 1 + n);
        if (a[n] < d) {
            long long now = max((d - 2 * a[n] - 1) / a[n] + 1, 0LL);    d -= now * a[n];
            if (!d) ans = min(ans, now);
            else if (st.find(d) != st.end()) {
                ans = min(ans, now + 1);
            }
            else {
                for (int i = 1; i <= n; i++) {
                    if (st.find(d - a[i]) != st.end()) {
                        ans = min(ans, now + 2);
                    }
                }
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
long long a[maxn];
int main() {
    int T;  cin >> T;
    while (T--) {
        long long n, d;   cin >> n >> d;
        long long ans = LONG_LONG_MAX;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
            if (a[i] > d) {
                ans = min(ans, 2LL);
            }
            else if (a[i] == d) {
                ans = 1;
                break;
            }
            else {
                ans = min(ans, (d - 1) / a[i] + 1);
            }
        }
        cout << ans << '\n';
    }
    getchar(); getchar();
    return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	    long long int arr[n];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	        sort(arr,arr+n);
	     long long int value[x+1];
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp= value[i-arr[j]];
	             if((temp!=INT_MAX) && (temp+1<value[i]))
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(long long int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	    long long int arr[n];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	     long long int value[x+1];
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp= value[i-arr[j]];
	             if((temp!=INT_MAX) && (temp+1<value[i]))
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(long long int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    int ans=0;
	    int arr[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	     int value[x+1];
	     value[0]=0;
	     for(int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(int i=1;i<=x;i++)
	     {
	         for(int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             int temp=value[i-arr[j]];
	             if(temp!=INT_MAX && temp+1<value[i])
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(int j=x-1;j>=0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	   long long int arr[n+1];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {

	     vector<long long int> value(x+1);
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp= value[i-arr[j]];
	             if((temp!=INT_MAX) && (temp+1<value[i]))
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(long long int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	   long long int arr[n];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	        int s=arr[0];
	        for(int i=0;i<n;i++)
	        {
	           if(arr[i]>s)
	           s=arr[i];
	        }
	     long long int y= ceil(((double(x)/double(s))));
	cout<<y<<"\n";
	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	   long long int arr[n+1];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	     sort(arr,arr+n);
	     vector<long long int> value(x+1);
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp= value[i-arr[j]];
	             if((temp!=INT_MAX) && (temp+1<value[i]))
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(long long int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	    long long int arr[n];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	     long long int value[x+1];
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp=value[i-arr[j]];
	             if(temp!=INT_MAX && temp+1<value[i])
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,x;
	    cin>>n>>x;
	    bool flag1=0,flag2=0;
	    long long int ans=0;
	   long long int arr[n];
	    for(long long int i=0;i<n;i++)
	    {
	        cin>>arr[i];
	        if(arr[i]==x)
	        {
	           flag1=1;
	        }
	        else if(arr[i]>x)
	        {
	            flag2=1;
	        }
	    }
	    if(flag1==1)
	    {
	        cout<<"1\n";
	        continue;
	    }
	    else if(flag2==1)
	    {
	        cout<<"2\n";
	        continue;
	    }
	    else
	    {
	     //sort(arr,arr+n);
	     vector<long long int> value(x+1);
	     value[0]=0;
	     for(long long int i=1;i<=x;i++)
	     value[i]=INT_MAX;

	     for(long long int i=1;i<=x;i++)
	     {
	         for(long long int j=0;j<n;j++)
	         {
	             if (arr[j] <= i)
	             {
	             long long int temp= value[i-arr[j]];
	             if((temp!=INT_MAX) && (temp+1<value[i]))
	             value[i]=temp+1;
	             }
	         }
	     }

	     if(value[x]!=INT_MAX)
	     {
	         cout<<value[x]<<"\n";
	         continue;
	     }
	     else{
	         for(long long int j=x-1;j>0;j--)
	         {
	             if(value[j]!=INT_MAX)
	             {
	                 cout<<value[j]+2<<"\n";
	                 break;
	             }
	         }
	     }

	    }

	}
	return 0;
}


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

int main(){
    int t;
    cin >> t;
    while( t-- ){
        ll n, x;
        cin >> n >> x;
        vector<ll>v(n);
        int flag = -1;
        for( int i = 0; i < n; i++ ){
            cin >> v[i];
            if( 2*v[i] > x ){
                if( flag != 1 ){
                    flag = 2;
                }
            }
            if( v[i] == x ){
                flag = 1;
            }
        }
        if( flag != -1 ){
            cout << flag << "\n";
            continue;
        }
        sort( v.begin(), v.end() );
        reverse( v.begin(), v.end() );
        int ans = 0;
        ll a = v[0];
        ll tempX = a*2 - 1;
        ans = x/tempX;
        ans = ans*2;
        if( x%tempX > 0 ){
            ans += 1;
        }
        cout << ans << "\n";
    }
}


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

int main(){
    int t;
    cin >> t;
    while( t-- ){
        ll n, x;
        cin >> n >> x;
        vector<ll>v(n);
        int flag = -1;
        for( int i = 0; i < n; i++ ){
            cin >> v[i];
            if( 2*v[i] > x ){
                flag = 2;
            }
            if( v[i] == x ){
                flag = 1;
            }
        }
        if( flag != -1 ){
            cout << flag << "\n";
            continue;
        }
        sort( v.begin(), v.end() );
        reverse( v.begin(), v.end() );
        int ans = 0;
        ll a = v[0], b = -1;
        if( n > 1 ){
            b = v[1];
        }
        if( n == 1 ){
            ll times = x/v[0];
            if( x%v[0] == 0 ){
                ans = x/v[0];
            }else{
                ll times = x/v[0];
                ll tempX = x - times*v[0];
                if( v[0]*2 > tempX && tempX > 0 ){
                    times--;
                }
                ans = times+2;
            }
        }else{
            ll times = x/v[0];
            ll tempX = x - v[0]*times;
            if( v[0]*2 > tempX && tempX > 0 ){
                times--;
            }
            ans = times + ((tempX<0)?0:2);
        }
        cout << ans << "\n";
    }
}


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

int main(){
    int t;
    cin >> t;
    while( t-- ){
        ll n, x;
        cin >> n >> x;
        vector<ll>v(n);
        int flag = -1;
        for( int i = 0; i < n; i++ ){
            cin >> v[i];
            if( 2*v[i] > x ){
                if( flag != 1 ){
                    flag = 2;
                }
            }
            if( v[i] == x ){
                flag = 1;
            }
        }
        if( flag != -1 ){
            cout << flag << "\n";
            continue;
        }
        sort( v.begin(), v.end() );
        ll maxValue = v[n-1]*2 - 1;
        ll ans = 0;
        ll temp = x/maxValue;
        if( maxValue == 1 ){
            ans = x;
        }else{
            ans = temp*2;
            if( x%maxValue > 0 ){
                ans++;
            }
        }
        cout << ans << endl;
    }
}


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

int main(){
    int t;
    cin >> t;
    while( t-- ){
        ll n, x;
        cin >> n >> x;
        vector<ll>v(n);
        int flag = -1;
        for( int i = 0; i < n; i++ ){
            cin >> v[i];
            if( v[i] == x ){
                flag = 1;
            }
        }
        if( flag != -1 ){
            cout << flag << "\n";
            continue;
        }
        sort( v.begin(), v.end() );
        ll maxValue = v[n-1]*2 - 1;
        ll ans = 0;
        ll temp = x/maxValue;
        if( maxValue == 1 ){
            ans = x;
        }else{
            if( temp == 0 ){
                ans = 2;
            }else{
                ans=temp*2;
                if( x%maxValue > 0 ){
                    ans+=1;
                }
            }
        }
        cout << ans << endl;
    }
}


import java.util.*;
import java.io.*;
public class Main {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }
    static int pow[];
    static class TrieNode {
        TrieNode children[];
        int EndOfWord;
        TrieNode() {
            children=new TrieNode[2];
            EndOfWord=0;
            for(int i=0;i<2;i++) {
                children[i]=null;
            }
        }
    }
    public static void insert(TrieNode root, StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord++;
            }
        }
    }
    public static boolean search(TrieNode root,int indx,StringBuilder str,StringBuilder ans) {
        TrieNode tmp=root;
        if(root.EndOfWord>0) {
            return true;
        }
        if(indx==str.length()) {
            return false;
        }
        if(str.charAt(indx)=='0') {
            if(root.children[1]!=null) {
                ans.append(1);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[0]!=null) {
                ans.append(0);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        if(str.charAt(indx)=='1') {
            if(root.children[0]!=null) {
                ans.append(1);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[1]!=null) {
                ans.append(0);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        return false;
    }
    //Only logically deleting
    public static void delete(TrieNode root,StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord--;
            }
        }
    }

    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        pow=new int[32];
        pow[0]=1;
        for(int i=1;i<pow.length;i++) {
            pow[i]=2*pow[i-1];
        }
        TrieNode root=new TrieNode();
        int query=input.scanInt();
        StringBuilder ans=new StringBuilder("");
        insert(root,dec_to_bin(0));
        for(int q=1;q<=query;q++) {
            char type=input.scanString().charAt(0);
            int x=input.scanInt();
            if(type=='+') {
                insert(root,dec_to_bin(x));
            }
            else if(type=='-') {
                delete(root,dec_to_bin(x));
            }
            else {
                StringBuilder tmp=new StringBuilder("");
                search(root,0,dec_to_bin(x),tmp);
                ans.append(bin_to_dec(tmp)+"\n");
            }
        }
        System.out.println(ans);
    }
    public static StringBuilder dec_to_bin(int n) {
        StringBuilder ans=new StringBuilder("");
        while(n!=0) {
            ans.append(n%2);
            n/=2;
        }
        while(ans.length()!=31) {
            ans.append(0);
        }
        ans=ans.reverse();
        return ans;
    }
    public static int bin_to_dec(StringBuilder str) {
        int ans=0;
        for(int i=0;i<str.length();i++) {
            if(str.charAt(i)=='1') {
                ans+=pow[str.length()-i-1];
            }
        }
        return ans;
    }
}


import java.util.*;
import java.io.*;
public class Main {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }
    static int pow[];
    static class TrieNode {
        TrieNode children[];
        int EndOfWord;
        TrieNode() {
            children=new TrieNode[2];
            EndOfWord=0;
            for(int i=0;i<2;i++) {
                children[i]=null;
            }
        }
    }
    public static void insert(TrieNode root, StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord++;
            }
        }
    }
    public static boolean search(TrieNode root,int indx,StringBuilder str,StringBuilder ans) {
        TrieNode tmp=root;
        if(root.EndOfWord>0) {
            return true;
        }
        if(indx==str.length()) {
            return false;
        }
        if(str.charAt(indx)=='0') {
            if(root.children[1]!=null) {
                ans.append(1);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[0]!=null) {
                ans.append(0);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        if(str.charAt(indx)=='1') {
            if(root.children[0]!=null) {
                ans.append(1);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[1]!=null) {
                ans.append(0);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        return false;
    }
    //Only logically deleting
    public static void delete(TrieNode root,StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord--;
            }
        }
    }

    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        pow=new int[32];
        pow[0]=1;
        for(int i=1;i<pow.length;i++) {
            pow[i]=2*pow[i-1];
        }
        TrieNode root=new TrieNode();
        int query=input.scanInt();
        StringBuilder ans=new StringBuilder("");
        for(int q=1;q<=query;q++) {
            char type=input.scanString().charAt(0);
            int x=input.scanInt();
            if(type=='+') {
                insert(root,dec_to_bin(x));
            }
            else if(type=='-') {
                delete(root,dec_to_bin(x));
            }
            else {
                StringBuilder tmp=new StringBuilder("");
                search(root,0,dec_to_bin(x),tmp);
                ans.append(bin_to_dec(tmp)+"\n");
            }
        }
        System.out.println(ans);
    }
    public static StringBuilder dec_to_bin(int n) {
        StringBuilder ans=new StringBuilder("");
        while(n!=0) {
            ans.append(n%2);
            n/=2;
        }
        while(ans.length()!=31) {
            ans.append(0);
        }
        ans=ans.reverse();
        return ans;
    }
    public static int bin_to_dec(StringBuilder str) {
        int ans=0;
        for(int i=0;i<str.length();i++) {
            if(str.charAt(i)=='1') {
                ans+=pow[str.length()-i-1];
            }
        }
        return ans;
    }
}


import java.util.*;
import java.io.*;
public class Main {
    static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }
    static int pow[];
    static class TrieNode {
        TrieNode children[];
        int EndOfWord;
        TrieNode() {
            children=new TrieNode[2];
            EndOfWord=0;
            for(int i=0;i<2;i++) {
                children[i]=null;
            }
        }
    }
    public static void insert(TrieNode root, StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord++;
            }
        }
    }
    public static boolean search(TrieNode root,int indx,StringBuilder str,StringBuilder ans) {
        TrieNode tmp=root;
        if(root.EndOfWord>0) {
            return true;
        }
        if(indx==str.length()) {
            return false;
        }
        if(str.charAt(indx)=='0') {
            if(root.children[1]!=null) {
                ans.append(1);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[0]!=null) {
                ans.append(0);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        if(str.charAt(indx)=='1') {
            if(root.children[0]!=null) {
                ans.append(1);
                if(search(root.children[0],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
            if(root.children[1]!=null) {
                ans.append(0);
                if(search(root.children[1],indx+1,str,ans)) {
                    return true;
                }
                ans.deleteCharAt(ans.length()-1);
            }
        }
        return false;
    }
    //Only logically deleting
    public static void delete(TrieNode root,StringBuilder str) {
        TrieNode tmp=root;
        for(int i=0;i<str.length();i++) {
            int indx=str.charAt(i)-48;
            if(tmp.children[indx]==null) {
                tmp.children[indx]=new TrieNode();
            }
            tmp=tmp.children[indx];
            if(i==str.length()-1) {
                tmp.EndOfWord--;
            }
        }
    }

    public static void main(String args[]) throws IOException {
        Scan input=new Scan();
        pow=new int[32];
        pow[0]=1;
        for(int i=1;i<pow.length;i++) {
            pow[i]=2*pow[i-1];
        }
        TrieNode root=new TrieNode();
        int query=input.scanInt();
        StringBuilder ans=new StringBuilder("");
        for(int q=1;q<=query;q++) {
            char type=input.scanString().charAt(0);
            int x=input.scanInt();
            if(type=='+') {
                insert(root,dec_to_bin(x));
            }
            else if(type=='-') {
                delete(root,dec_to_bin(x));
            }
            else {
                StringBuilder tmp=new StringBuilder("");
                if(search(root,0,dec_to_bin(x),tmp)) {
                    ans.append(bin_to_dec(tmp)+"\n");
                }
                else {
                    ans.append(1+"\n");
                }
            }
        }
        System.out.println(ans);
    }
    public static StringBuilder dec_to_bin(int n) {
        StringBuilder ans=new StringBuilder("");
        while(n!=0) {
            ans.append(n%2);
            n/=2;
        }
        while(ans.length()!=31) {
            ans.append(0);
        }
        ans=ans.reverse();
        return ans;
    }
    public static int bin_to_dec(StringBuilder str) {
        int ans=0;
        for(int i=0;i<str.length();i++) {
            if(str.charAt(i)=='1') {
                ans+=pow[str.length()-i-1];
            }
        }
        return ans;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import java.util.StringTokenizer;

public class Solution{

    public static void main(String[] args) {

    	FastScanner fs = new FastScanner();
    	PrintWriter out = new PrintWriter(System.out);

    	int tt = 1;
    	while(tt-->0) {

    		int q = fs.nextInt();

    		Trie trie = new Trie();
    		trie.insert(0);

    		while(q-->0) {
    			char ch = fs.nextChar();
    			int n = fs.nextInt();
    			switch(ch) {
    			case '+':
    				trie.insert(n);
    				break;
    			case '-':
    				trie.delete(n);
    				break;
    			case '?':
    				out.println(trie.maxxor(n));
    				break;
    			}
    		}

    	}

    	out.close();

    }

    static class Node{
    	Node[] node = new Node[2];
    	int cnt = 0;
    }

    static class Trie{
    	Node root = new Node();

    	void insert(int n) {
    		Node temp = root;
    		for(int i=29;i>=0;i--) {
    			int cur = ((n>>i)&1);
    			if(temp.node[cur]==null) {
    				temp.node[cur] = new Node();
    			}
    			temp = temp.node[cur];
    			temp.cnt++;
    		}
    	}

    	void delete(int n) {
    		Node temp = root;
    		for(int i=29;i>=0;i--) {
    			int cur = ((n>>i)&1);
    			temp = temp.node[cur];
    			temp.cnt--;
    		}
    	}

    	int maxxor(int x) {
    		Node temp = root;
    		int ans = 0;
    		for(int i=29;i>=0;i--) {
    			int cur = ((x>>i)&1);
    			if(temp.node[cur^1]!=null && temp.node[cur^1].cnt>0) {
    				ans += (1<<i);
    				temp = temp.node[cur^1];
    			}
    			else {
    				temp = temp.node[cur];
    			}
    		}

    		return ans;

    	}

    }

    static final Random random=new Random();

    static void ruffleSort(int[] a) {
    	int n=a.length;//shuffle, then sort
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); int temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }

    static class FastScanner{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");

    	public String next(){
    		while(!st.hasMoreElements()){
    			try{
    				st = new StringTokenizer(br.readLine());
    			} catch(IOException e){
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}

    	public String nextLine() throws IOException {
    		return br.readLine();
    	}

    	public int nextInt(){
    		return Integer.parseInt(next());
    	}

    	public int[] readArray(int n){
    		int[] a = new int[n];
    		for(int i=0;i<n;i++)
    			a[i] = nextInt();
    		return a;
    	}

    	public long nextLong() {
    		return Long.parseLong(next());
    	}

    	public char nextChar() {
    		return next().toCharArray()[0];
    	}
    }

}