#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b;
  long int t;
  vector<int> books;
  scanf("%d %ld", &n, &t);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b);
    books.push_back(b);
  }
  long int temp = 0;
  int i = 0;
  while (i < n && temp + books[i] <= t) {
    temp += books[i++];
  }
  int max(i), j(i);
  i = 0;
  while (i < n) {
    temp -= books[i++];
    while (j < n && temp + books[j] <= t) {
      temp += books[j++];
    }
    if (max < j - i) max = j - i;
  }
  printf("%d\n", max);
}
