#include <bits/stdc++.h>
using namespace std;
long long a[10000000];
long long b[10000000];
long long n, t, m = 0;
int main() {
  cin >> n >> t;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long g = 1;
  long long sum = 0;
  for (int i = 1; i <= n; ++i) {
    while ((g <= n) && (sum + a[g] <= t)) {
      sum = sum + a[g];
      ++g;
    }
    if ((g - i) > m) m = (g - i);
    sum = sum - a[i];
  }
  cout << m;
  return 0;
}
