#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include <iostream>
//#include <algorithm>
#include <limits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
int N,K;
vector<vector<vector<double>>> dp;
//cout <<fixed << setprecision(10)<< ans;で、小数精度10桁にできる
/*void printdp(int N,ll Vmax){
	rep(i,N+1){
		for(ll j=0;j<Vmax+1;j++){
			if(dp[i][j]==llMAX)continue;
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	return;
}*/
double culc(int a1,int a2,int a3){
	if(dp[a1][a2][a3]!=-1){
		return dp[a1][a2][a3];
	}
	double result = 0;
	if(a1>0){
		result += culc(a1-1,a2,a3)*a1;
	}
	if(a2>0){
		result += culc(a1+1,a2-1,a3)*a2;
	}
	if(a3>0){
		result+= culc(a1,a2+1,a3-1)*a3;
	}
	result +=N;
	result /=(a1+a2+a3);
	//dp[a1][a2][a3] = (culc(a1-1,a2,a3)*a1+culc(a1+1,a2-1,a3)*a2+culc(a1,a2+1,a3-1)*a3+N)*(1/(a1+a2+a3));
	dp[a1][a2][a3] = result;
	return result;
}
int main(void){
	int a;
	cin >> N >> K;
	int a[N];
	rep(i,N){
		cin >> a[i];
	}
	vector<int> dp[10000];
	rep(k,K+1){
		int lose=0,cnt=0;
		rep(i,N){
			if(0<=k-a[i]){
				cnt++;
				if(!dp[k-a[i]])lose++;
			}
		}
        if (cnt == 0) dp[k] = 0;
        else if (0 < lose) dp[k] = 1;
        else dp[k] = 0;
	}
	cout <<dp[K];
	return 0;
}