#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592654;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long tc, l, k, sum = 0, x = 0, y, z = 0, m = 1, n = 0, ans = 0, cnt = 0;
  cin >> n >> x;
  int arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    x -= arr[i];
    if (x >= 0) cnt++;
  }
  if (x > 0) cnt--;
  cout << cnt << "\n";
}
