#include <bits/stdc++.h>
int teste(int* b, int n, int mid, int t) {
  int i;
  for (i = mid; i <= n; i++) {
    if (b[i] - b[i - mid] <= t) return 1;
  }
  return 0;
}
int main(void) {
  int n, t, i, j;
  int a[100001];
  int b[100001];
  int bot, top, mid, permanente;
  scanf("%d %d", &n, &t);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  b[0] = a[0] = 0;
  for (i = 1; i <= n; i++) b[i] = b[i - 1] + a[i];
  bot = 0;
  top = n;
  permanente = 0;
  while (top >= bot) {
    mid = (top + bot) / 2;
    if (teste(b, n, mid, t)) {
      permanente = mid;
      bot = mid + 1;
    } else {
      top = mid - 1;
    }
  }
  printf("%d\n", permanente);
  return 0;
}
