#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, t;
  cin >> n >> t;
  long long i, j, arr[n], a[n + 1], count = 0;
  a[0] = 0;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    a[i + 1] = a[i] + arr[i];
  }
  for (long long k = 1; k <= n; k++) {
    i = k;
    j = n;
    long long mid;
    while (i <= j) {
      mid = (i + j) / 2;
      if (a[mid] - a[k - 1] <= t) {
        i = mid + 1;
      } else {
        j = mid - 1;
      }
    }
    long long flag = 0;
    if (a[mid] - a[k - 1] <= t)
      flag = 1;
    else
      flag = 0;
    count = max(count, mid - k + flag);
  }
  cout << count;
  return 0;
}
