#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, x;
  cin >> n >> x;
  long a[n];
  long i = 0;
  while (i < n) {
    cin >> a[i];
    i++;
  }
  i = 0;
  int count = 0;
  while (i < n) {
    if (i != n - 1) {
      if (x >= a[i]) {
        x -= a[i];
        count++;
      }
    } else {
      if (x - a[i] == 0) {
        x -= a[i];
        count++;
      }
    }
    if (x == 0) break;
    i++;
  }
  printf("%d", count);
  return 0;
}
