#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(0);
  int n, t;
  cin >> n >> t;
  vector<int> v(n);
  for (int i = 0; i < (n); i++) cin >> v[i];
  int i = 0, j = 0, tt = 0, re = 0;
  while (i < ((int)(v).size()) && j < ((int)(v).size())) {
    if (tt + v[j] <= t) {
      tt += v[j];
      j++;
    } else {
      tt -= v[i];
      if (tt <= 0) {
        i++;
        j = i;
        tt = 0;
      } else {
        i++;
      }
    }
    re = max(re, j - i);
  }
  cout << re << endl;
  return 0;
}
