#include <bits/stdc++.h>
using namespace std;
int n, t;
int a[100010];
int main() {
  cin >> n >> t;
  for (int i = 0; i < n; i++) cin >> a[i];
  int maxCount = 0;
  int time = 0;
  for (int i = 0, j = 0, count = 0; i < n; i++) {
    while (time + a[j] <= t && j < n) {
      time += a[j];
      j++;
      count++;
    }
    time -= a[i];
    if (count > maxCount) maxCount = count;
    count--;
  }
  cout << maxCount << endl;
  return 0;
}
