#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j = 0, n, t, q = 0, s = 0, w = 0;
  cin >> t >> n;
  vector<long long> v;
  for (i = 0; i < t; i++) {
    cin >> q;
    v.push_back(q);
  }
  q = 0;
  for (i = 0; i < t; i++) {
    s += v[i];
    q++;
    if (s > n) {
      s -= v[w];
      q--;
      w++;
      j = max(q, j);
    }
  }
  j = max(q, j);
  cout << j << endl;
  return 0;
}
