#include <bits/stdc++.h>
int main() {
  long long int n, ttl, i, j, temp, arr[100005], h = 0;
  scanf("%lld%lld", &n, &ttl);
  for (i = 1; i <= n; i++) scanf("%lld", &arr[i]);
  for (i = 1; i < n; i++) {
    if ((ttl - arr[i]) >= 0) {
      h++;
      ttl -= arr[i];
    }
  }
  if (ttl == arr[n]) h++;
  printf("%d", h);
  return 0;
}
