#include <bits/stdc++.h>
int n;
int t;
int a[100000];
int main(void) {
  int i;
  int aval;
  int read_able_n = 0;
  int max = 0;
  scanf("%d", &n);
  scanf("%d", &t);
  aval = t;
  int st_i = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    while (aval < a[i]) {
      aval += a[st_i++];
      read_able_n--;
    }
    aval -= a[i];
    read_able_n++;
    if (max < read_able_n) {
      max = read_able_n;
    }
  }
  printf("%d\n", max);
  return 0;
}
