#include <bits/stdc++.h>
using namespace std;
long long arr[1000000], arr2[1000000];
map<long long, bool> mop;
map<long long, long long> mopp;
int main() {
  long long a, t, ans = 0;
  scanf("%I64d", &a);
  ;
  scanf("%I64d", &t);
  ;
  for (int i = 0; i < a; i++) {
    cin >> arr[i];
    arr2[i] = arr2[i - 1] + arr[i];
    if (arr2[i] <= t) {
      ans = i + 1;
    }
  }
  for (int i = 0; i < a; i++) {
    long long b = i, e = a - 1, mid;
    while (e > b) {
      mid = (b + e + 1) / 2;
      if (arr2[mid] - arr2[i] + arr[i] <= t) {
        b = mid;
      } else {
        e = mid - 1;
      }
    }
    if (arr2[b] - arr2[i] + arr[i] <= t) {
      ans = max(ans, b - i + 1);
    }
  }
  printf("%I64d\n", ans);
  ;
  return 0;
}
