#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  vector<long long int> a(n + 1);
  a[0] = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  int mx = -1;
  for (int i = 0; i <= n; i++) {
    auto it = upper_bound(a.begin(), a.end(), a[i] + t);
    it--;
    int index = it - a.begin();
    mx = max(mx, (index - i));
  }
  cout << mx << "\n";
}
