#include #define FOR(I,A,B) for(int I=A;I> L >> N; vector W(N); FOR(i,0,N) cin >> W[i]; sort(ALL(W)); int a=0; int s=0; FOR(i,0,N) { s+=W[i]; if ( s >= L ) break; a++; } cout << a << endl; return EXIT_SUCCESS; }