#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = LLONG_MAX;
long long n, t;
long long pre[100001];
long long bin_srch(long long num) {
  long long res = -1;
  long long l = 0, h = n - 1;
  if (num > pre[n - 1]) {
    return n - 1;
  }
  while (l <= h) {
    long long mid = l + (h - l) / 2;
    if (pre[mid] == num) return mid;
    if (pre[mid] < num)
      l = mid + 1;
    else {
      h = mid - 1;
      res = mid - 1;
    }
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> t;
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      cin >> pre[i];
    } else {
      cin >> pre[i];
      pre[i] += pre[i - 1];
    }
    if (pre[i] <= t) mx = i + 1;
  }
  if (pre[n - 1] <= t)
    cout << n;
  else {
    for (int i = 0; i < n; i++) {
      long long x = pre[i] + t;
      long long ind = bin_srch(x);
      if (ind != -1) mx = max(mx, ind - i);
    }
    cout << mx;
  }
  return 0;
}
