#include #include using namespace std; int main() { int L, N = 0; cin>>L; cin>>N; int W[N]; for(int i=0; i>W[i]; // sort /*int swap = 0; for(int i=0; i W[j]) { swap = W[i]; W[i] = W[j]; W[j] = swap; } } }*/ sort(&W[0],&W[N-1]); int sum = 0; int num = 0; for(int i=0; iL) { num = i; break; } } if (sum <= L) { num = N; } cout<< num <