#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], x, maxx = 0, suma, l, r, y;
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  l = 0;
  r = 1;
  while (l != n) {
    if (r < l) {
      r = l;
      y = 0;
    }
    if (r <= n && suma + a[r] <= x) {
      suma += a[r];
      y++;
      r++;
      maxx = max(maxx, y);
    } else {
      l++;
      suma -= a[l];
      y--;
    }
  }
  cout << maxx;
}
