#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  int l = 0, r = 0, ans = 0;
  long long sum = 0;
  while (r != n) {
    sum += arr[r];
    if (sum <= t) {
      ans = max(ans, r - l + 1);
    }
    while (sum > t) {
      sum -= arr[l];
      ++l;
    }
    ++r;
  }
  cout << ans;
  return 0;
}
