#include #include #include using namespace std; vector a; int N,K,ans=0; int dfs(int i,int sum){ if(i==N){ if(sum<=K) return ans = max(ans,sum); else return ans; } dfs(i+1,sum); dfs(i+1,sum+a[i]); return ans; } int main(){ int x; cin >> N >> K; for(int i=0;i> x; a.push_back(x); } cout << dfs(0,0); }