#include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,l,n) for(lint i=l;i vi; typedef vector vli; typedef vector vvi; typedef pair pii; int main(){ int n,m; cin>>n>>m; vi c(n); rep(i,0,n) cin>>c[i]; sort(all(c)); int ans=0; rep(i,1,n){ if(c[i-1]<=m) ans=i; c[i]+=c[i-1]; } if(c[n-1]<=m) ans=n; o(ans); }