#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll N,X; pair P[101]; ll A[101]; int dp[220000]; char ok[101]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>X; FOR(i,N) cin>>P[i].first, P[i].second=i, ok[i]='x'; sort(P,P+N); FOR(i,N) A[i]=P[i].first; ll sum=0; MINUS(dp); dp[0]=0; FOR(i,N) { if(sum+A[i]>=200000) break; for(j=sum;j>=0;j--) if(dp[j]>=0 && dp[j+A[i]]==-1) dp[j+A[i]]=i; sum+=A[i]; } assert(N-i<=25); int low=i; for(int mask=0;mask<1<<(N-low);mask++) { ll t=0; FOR(i,N-low) if(mask&(1<200000) continue; if(dp[X-t]>=0) { FOR(i,N-low) if(mask&(1<