#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long from, to, w;
  edge(long long from, long long to, long long w) : from(from), to(to), w(w) {}
  bool operator<(const edge& e) const { return (w > e.w); }
};
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long fx(long long n, long long md) { return ((n % md) + md) % md; }
void O_o() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
long long sum[1 << 17], k, n, x;
bool ok(long long mid) {
  for (int i = 1; i <= int(n); i++) {
    if (i + mid > n) break;
    if (sum[i + mid] - sum[i - 1] <= k) return 1;
  }
  return 0;
}
int main() {
  O_o();
  cin >> n >> k;
  for (int i = 1; i <= int(n); i++) cin >> x, sum[i] = x + sum[i - 1];
  long long second = 0, e = n;
  while (second < e) {
    long long mid = (second + e) >> 1;
    if (ok(mid))
      second = mid + 1;
    else
      e = mid;
  }
  cout << second << endl;
}
