#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n >> x;
  long long a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  int cnt = 0;
  bool flag = false;
  for (int i = 0; i < n; ++i) {
    x -= a[i];
    if (x >= 0) cnt++;
    if (x == 0) {
      flag = true;
    }
  }
  cout << (max(0, flag ? cnt : cnt - 1)) << "\n";
}
