#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int pref[n + 1];
  pref[0] = 0;
  for (int i = 1; i <= n; i++) pref[i] = pref[i - 1] + a[i - 1];
  int finans = 0;
  for (int i = 1; i <= n; i++) {
    int lo = 1;
    int hi = i;
    int mid;
    int ans = -1;
    while (lo <= hi) {
      mid = (hi + lo) / 2;
      if (pref[i] - pref[mid - 1] <= t) {
        ans = mid;
        hi = mid - 1;
      } else
        lo = mid + 1;
    }
    if (ans != -1) finans = max(finans, i - ans + 1);
  }
  cout << finans << endl;
  return 0;
}
