#include <bits/stdc++.h>
using namespace std;
int N, K;
int main() {
  scanf("%d%d", &N, &K);
  vector<int> a(N);
  int r = 0;
  int f = 1;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    K -= a[i];
    if (K < 0) {
      f = 0;
      break;
    }
    r += 1;
  }
  if (f == 1 and K != 0) {
    printf("%d", r - 1);
  } else {
    printf("%d", r);
  }
}
