#include <bits/stdc++.h>
using namespace std;
int arr[100009];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int i = 0, j = 0;
  int cur = 0, res = 0;
  while (j < n) {
    if (arr[j] > t) {
      j++;
      i = j;
      cur = 0;
      continue;
    }
    cur += arr[j];
    while (cur > t) cur -= arr[i++];
    j++;
    res = max(res, j - i);
  }
  cout << res << endl;
  return 0;
}
