#include <bits/stdc++.h>
int a[100050];
int main() {
  int n, t, s, max;
  int i, j, b;
  while (scanf("%d%d", &n, &t) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    max = s = b = 0;
    for (i = 0; i < n; i++) {
      s += a[i];
      b++;
      if (s > t) {
        if (max < b - 1) max = b - 1;
        s -= a[i - b + 1];
        b--;
      }
      if (s <= t) {
        if (max < b) max = b;
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
