#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int *a = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int *b = new int[n];
  b[0] = a[0];
  for (int i = 1; i < n; ++i) {
    b[i] = a[i] + b[i - 1];
  }
  int Answer = 0;
  for (int i = 0; i < n; ++i) {
    int answer = -1;
    int L = 0;
    int R = n - i - 1;
    while (L <= R) {
      int m = (L + R) / 2;
      int temp;
      if (i == 0)
        temp = 0;
      else
        temp = b[i - 1];
      temp = b[i + m] - temp;
      if (temp > t)
        R = m - 1;
      else {
        answer = m;
        L = m + 1;
      }
    }
    Answer = max(Answer, answer + 1);
  }
  cout << Answer << endl;
  return 0;
}
