#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, ans, tmp;
  vector<int> a;
  cin >> n >> x;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  ans = 0;
  tmp = 0;
  for (int i = 0; i < n; i++) {
    if (x >= a[i]) {
      if (i == n - 1) {
        if (x != a[i])
          break;
        else {
          ans++;
          x -= a[i];
        }
      } else {
        x -= a[i];
        ans++;
      }
    } else
      continue;
  }
  cout << ans << '\n';
}
