#include #include #include using namespace std; int main(){ int L,N,cnt; cin >> L >> N; vector W(N+1); for(int i=0;i> W[i]; W[N]=L+1; sort(W.begin(),W.end()); for(cnt=0;cnt<=N;cnt++){ L-=W[cnt]; if(L<0)break; } cout << cnt << endl; return 0; }