#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, r = 0, a, m = 0;
  cin >> n >> k;
  long long b[n + 1];
  b[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a;
    b[i] = b[i - 1] + a;
    if (b[i] - b[m] <= k) {
      r = max(r, i - m);
    } else
      m++;
  }
  cout << r;
  return 0;
}
