#include #include #include int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); int L, N, ans=0; std::cin >> L >> N; std::vector W(N); for(int i=0; i> W[i]; } std::sort(W.begin(), W.end(), std::less()); while(true){ L -= W[ans]; if(L<0) break; ++ans; } std::cout << ans << "\n"; return 0; }