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