#include #include #include #include #include #include #include #define REP(i,n) for(int i=0;i> n >> k; REP(i, n){ cin >> a[i]; } REP(BIT, 1 << n){ temp = 0; REP(i, n){ if (BIT&(1 << i)){ temp += a[i]; } } if (temp <= k){ ans = max(ans, temp); } } cout << ans << endl; return 0; }