#include <bits/stdc++.h>
using namespace std;
unsigned long long s[100005], i = 1, r, m, t, f, x;
int main() {
  cin >> t >> f;
  for (i = 1; i <= t; i++) {
    cin >> x;
    s[i] = s[i - 1] + x;
    if (s[i] - s[m] > f) m++;
    r = max((i - m), r);
  }
  cout << r;
}
