#include #include #include #include using namespace std; int main(){ int l, n, i, w, count; vector w_v; cin >> l >> n; for (i = 0;i> w; w_v.push_back(w); } sort(w_v.begin(),w_v.end()); i = 0; while(true){ if (w_v[i] > l){ break; } l = l - w_v[i]; count++; i++; } cout << count << endl; }