#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int i, j, n, ans = 0, m, s, begin;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  begin = 0;
  s = 0;
  for (i = 0; i < n; i++) {
    s += a[i];
    while (s > m) {
      s -= a[begin];
      begin++;
    }
    ans = max(ans, i - begin + 1);
  }
  printf("%d\n", ans);
  return 0;
}
