#include using namespace std; int L,N,W[1<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>L>>N; for(int i=0;i>W[i]; sort(W,W+N); int ans=0,i=0; while(i0) { L-=W[i++]; ans++; } cout << ans << endl; }