#include <bits/stdc++.h>
using namespace std;
const long long INF = 999999999;
const long long INFL = 99999999999999999LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
long long a[100005];
int32_t main() {
  long long n, t;
  scanf("%I64d", &n);
  ;
  scanf("%I64d", &t);
  ;
  for (long long i = 0; i < n; i++) scanf("%I64d", &a[i]);
  ;
  long long ans = 0;
  long long l = 0, r = 0;
  long long cur = 0;
  long long s = 0;
  while (l < n) {
    while (r < n and s + a[r] <= t) {
      s += a[r];
      r++;
      cur++;
      ans = ((ans) > (cur) ? (ans) : (cur));
    }
    l++;
    if (l > r)
      r++;
    else {
      s -= a[l - 1];
      cur--;
    }
  }
  cout << ans << endl;
  return 0;
}
