#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long t, n, k, i;
  cin >> n >> k;
  long long a[n], cnt = 0, cost, l = 0, r = 0, maxrem = 0, rem = k;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 1; i < n; i++) a[i] += a[i - 1];
  while (r < n) {
    if (!l)
      cost = a[r];
    else
      cost = a[r] - a[l - 1];
    if (cost <= k) {
      rem = k - cost;
      if (cnt < (r - l + 1)) {
        cnt = r - l + 1;
      }
      r++;
    } else {
      if (l == r) r++;
      l++;
    }
  }
  if (cnt)
    cout << cnt;
  else
    cout << 0;
  cout << "\n";
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
  return 0;
}
