#include <bits/stdc++.h>
using namespace std;
const unsigned MAXN = 1e5 + 10;
int F[MAXN];
int n, t;
int binarySearch(int, int);
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> t;
  F[0] = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    F[i] = F[i - 1] + x;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int p = binarySearch(i, n);
    if (p != -1) ans = max(ans, p - i + 1);
  }
  cout << ans << "\n";
  return 0;
}
int binarySearch(int l, int r) {
  int ll = l - 1;
  while (l < r) {
    int m = (l + r + 1) / 2;
    if (F[m] - F[ll] <= t)
      l = m;
    else
      r = m - 1;
  }
  return (F[l] - F[ll] <= t ? l : -1);
}
