#include <bits/stdc++.h>
using namespace std;
void IO() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
int main() {
  IO();
  long long n, t, a[100500];
  cin >> n >> t;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  unsigned long long sum = 0;
  long long counter = 0, ans = 0, j = 0;
  for (long long i = 0; i < n; i++) {
    sum += a[i];
    counter++;
    while (sum > t) {
      sum -= a[j];
      counter--;
      j++;
    }
    ans = max(ans, counter);
  }
  cout << ans << endl;
  return 0;
}
