#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int x;
  istringstream iss(s);
  iss >> x;
  return x;
}
template <class T>
inline string toString(T x) {
  ostringstream oss;
  oss << x;
  return oss.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
static const auto io_sync_off = []() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return nullptr;
}();
int main(int argc, char *argv[]) {
  int n;
  long long x;
  cin >> n >> x;
  vector<long long> a(n);
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  long long sum = 0;
  int cnt = 0;
  for (int i = 0; i < (int)n; ++i) {
    if (sum + a[i] <= x) {
      sum += a[i];
      cnt++;
    }
  }
  if (cnt == n && sum != x) cnt--;
  cout << cnt << endl;
  return 0;
}
