#include #include using namespace std; int main() { int l, n; cin >> l >> n; vector w(n); for (auto &x : w) cin >> x; int sum = 0; for (int i = 0; i < n; ++i) { sum += w[i]; if (sum > l) { cout << i << endl; return 0; } } cout << n << endl; }