#include <bits/stdc++.h>
using namespace std;
const long double _PI = 3.141592653589793115997963468544185161590576171875;
const long double TTT = 1.000000011;
template <typename T>
inline T min(T &x, T &y) {
  return x > y ? y : x;
}
template <typename T>
inline T max(T &x, T &y) {
  return x > y ? x : y;
}
template <typename T>
inline T _min(T &x, T y) {
  return x > y ? x = y : x;
}
inline long double abs(pair<long long, long long> x) {
  return sqrt(1.0 * (x.first * x.first) + 1.0 * (x.second * x.second));
}
int main() {
  long long ma = 0, n, t, j = 1, temp;
  cin >> n >> t;
  vector<long long> a(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> temp;
    a[i] = a[i - 1] + temp;
  }
  for (long long i = 0; i <= n; i++) {
    for (; j <= n && a[j] - a[i] <= t; j++)
      ;
    ma = max(ma, j - i - 1);
  }
  cout << ma;
  return 0;
}
