#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int a[n], c = 0, max = 0, l = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (t < a[i]) {
      t = t + a[l];
      l++;
      c--;
    }
    t = t - a[i];
    c++;
    if (c > max) max = c;
  }
  cout << max;
}
