#include <bits/stdc++.h>
using namespace std;
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base);
    base = (base * base);
    exp /= 2;
  }
  return res;
}
struct ele {
  long long a, b;
  ele() { b = 0; }
};
bool comp(ele &a, ele &b) { return a.b > b.b; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long n, t;
  cin >> n >> t;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<long long> sum(n, 0);
  sum[n - 1] = v[n - 1];
  for (int i = n - 2; i >= 0; i--) sum[i] = sum[i + 1] + v[i];
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (sum[i] <= t) {
      ans = max(ans, n - i);
      continue;
    }
    if (v[i] > t) continue;
    long long low = i, high = n - 1, med;
    while ((high - low) > 1) {
      med = (high + low) / 2;
      if (sum[i] - sum[med + 1] <= t)
        low = med;
      else
        high = med;
    }
    ans = max(ans, low - i + 1);
  }
  cout << ans << endl;
}
int main() {
  long long t = 1;
  for (long long i = 1; i <= t; i++) solve();
}
