#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i = 0; i < (N); ++i) {
    cin >> a.at(i);
  }
  int res = 0;
  for (int i = 0; i < N; ++i) {
    if (x <= 0) {
      break;
    }
    if (x >= a.at(i)) {
      ++res;
      x -= a.at(i);
    } else {
      break;
    }
  }
  cout << res << endl;
}
