#include <bits/stdc++.h>
using namespace std;
long long dx[4] = {0, 0, 1, -1};
long long dy[4] = {1, -1, 0, 0};
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(12) << fixed;
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first > b.first;
}
void solve() {
  long long n, x;
  cin >> n >> x;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    if (x >= a[i]) {
      x -= a[i];
      s++;
    } else {
      cout << s << "\n";
      return;
    };
  }
  if (x) s--;
  cout << s;
}
int main() {
  fast();
  long long t = 1;
  while (t--) {
    solve();
  }
}
