#include #include using namespace std; int main(){ int L, N; cin >> L >> N; int W[10000]; for(int i=0; i> W[i]; sort(W,W+N); int j=0; while(L>0){ L = L - W[j]; if(L<0) break; j++; } cout << j << endl; return 0; }