#include<bits/stdc++.h> using namespace std; int n, c, cnt=0; int w[1000]; int main(){ cin>>n>>c; for(int i=1; i<=n; i++){ cin>>w[i]; } for(int i=1; i<=n; i++){ if(w[i]>c) continue; cnt++; c-=w[i]; }cout<<cnt; return 0; }
茜汐兔求解!!!(我是女的)