#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long MAXN = 1e+5 + 7;
const long long MOD = 1e+9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
vector<long long> adj[MAXN];
long long visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
long long n, t;
long long a[MAXN];
long long pre[MAXN];
long long res = -INF;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  memset(pre, 0, sizeof(pre));
  cin >> n >> t;
  for (long long i = (1); i <= n; i++) cin >> a[i];
  a[n + 1] = INF;
  pre[1] = a[1];
  for (long long i = (2); i <= n; i++) pre[i] = pre[i - 1] + a[i];
  for (long long i = (1); i <= n; i++) {
    long long ind =
        upper_bound(pre + i, pre + n + 1, pre[i - 1] + t) - (pre + i);
    res = max(res, ind);
  }
  cout << res;
}
