#include <bits/stdc++.h>
using namespace std;
const int SIZE = 100000;
int a[SIZE], sum[SIZE];
int s(int i, int j) { return (i) ? sum[j] - sum[i - 1] : sum[j]; }
int main() {
  int n, t;
  scanf("%d %d", &n, &t);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  sum[0] = a[0];
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= t) {
      int idx = i;
      int begin = i;
      int end = n - 1;
      while (begin <= end) {
        int mid = (begin + end) / 2;
        int required = s(i, mid);
        if (required <= t) {
          idx = mid;
          begin = mid + 1;
        } else {
          end = mid - 1;
        }
      }
      ans = max(ans, idx - i + 1);
    }
  }
  printf("%d\n", ans);
  return 0;
}
