#include #include #include int main(void) { int L, N; std::cin >> L >> N; std::vector W(N); int w; for (int i=0; i> w; W[i] = w; }; std::sort(W.begin(), W.end()); int ans = 0; int width_sum = 0; for (int w : W){ width_sum += w; if (width_sum > L){ break; }; ans++; } std::cout << ans << std::endl; }