#include <bits/stdc++.h>
using namespace std;
int a[100100];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) cin >> a[i];
  int sum = 0, len = 0, left = 0, right = 0;
  while (right < n) {
    if (sum < t) {
      sum += a[right++];
      if (sum <= t && len < right - left) len = right - left;
    } else {
      sum -= a[left++];
    }
  }
  cout << len << endl;
  return 0;
}
