#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<queue>
#include<unordered_map>
#include<map>
#include<stack>
#include<bits/stdc++.h>
#include<string.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
//#define f first
//#define s second
#define respr(fir,sec) for(int i=0;i<=fir;i++){for(int j=0;j<=sec;j++){cout << res[i][j] << " ";}cout << "\n";}
#define pb push_back
//#define INF (1LL<<31)
using namespace std;
using namespace __gnu_pbds;
const int mod = 1e9+7;
const ll MAX = 1000000000000000000;
typedef pair<int,ll> pii;
typedef pair<ll,int> pi;
typedef tuple<long long,int> tp;
typedef tuple<int,int,long long> tu;
typedef multimap<pii , int> mpp;
typedef priority_queue< tp , vector<tp>, greater<tp>>  minheap;
typedef priority_queue<pii , vector<pii>> maxheap;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
const int maxi = 100005;

vector<int> dp(maxi);

int main()
{
	FASTIO;
	int n,k;
	cin >> n >> k;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
		cin >> arr[i];
	
	for(int i=0;i<arr[0];i++)
		dp[i] = -1;

	for(int L=1;L<=k;L++){
		for(int R=0;R<n;R++){
			if(dp[L]==-1)	break;
			
			if(arr[R]<=L){
				if((L-arr[R]>=0 && dp[L-arr[R]]==-1) || (L-arr[R]>=0 && dp[L-arr[R]]==2)){
					dp[L]=1;
					break;
				}
			}
		}
		if(dp[L]==-1 || dp[L])
			continue;
		else
			dp[L] = (dp[arr[0]]==1)?2:1;
		
	}
	//for(int i=0;i<=k;i++)
		//cout << dp[i] << " ";
	//cout << "\n";
	cout << dp[k] << "\n";
	return 0;
}
