#include using namespace std; #define rep(i,n) for(ll i=0;i=0;i--) #define fi first #define se second #define all(x) (x).begin(),(x).end() #define CST(x) cout<; using vvl=vector>; using pl=pair; template inline bool chmin(T& a, T b){ if(a>b){a = b;return true;}return false;} template inline bool chmax(T& a, T b){ if(a>L>>N; vl info(N); rep(i,N)cin>>info[i]; sort(all(info)); int ans=0; rep(i,N){ if(L-info[i]>0){ L-=info[i]; ans++; } else break; } cout<