#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 998244353;
double eps = 1e-12;
int main() {
  int n, t;
  cin >> n >> t;
  vector<int> times(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> times[i];
  }
  int i = 0, j = 0;
  long long sum = 0;
  int maxi = 0;
  while (i < n) {
    while (sum + times[j] <= t && j < n) {
      sum += times[j];
      j++;
    }
    maxi = max(maxi, j - i);
    sum -= times[i];
    i++;
  }
  cout << maxi << "\n";
  return 0;
}
