#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, t;
  cin >> n >> t;
  vector<int> books(n);
  for (int i = 0; i < n; i++) {
    cin >> books[i];
  }
  int i, j;
  i = 0, j = 0;
  int ac = 0;
  int ans = 0;
  while (i < n) {
    if (i > j) j = i;
    while (ac < t && j < n) {
      ac += books[j];
      j++;
    }
    ans = max(ans, (j - (ac > t)) - i);
    ac -= books[i];
    i++;
  }
  cout << ans << endl;
  return 0;
}
