#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 1000000003 vector> get(vector a,int K){ int n = a.size(); vector dp(n+1,vector(K+1,false)); dp[0][0] = true; rep(i,n){ rep(j,K+1){ if(dp[i][j]){ dp[i+1][j] = true; if(j+a[i]<=K)dp[i+1][j+a[i]] = true; } } } return dp; } int main(){ int N,K; cin>>N>>K; vector a(N); rep(i,N){ cin>>a[i]; } auto x = get(a,K); reverse(a.begin(),a.end()); auto y = get(a,K); if(x.back().back()==false){ cout<<-1<