#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, t, l = 0, r = 0, time = 0, books = 0;
  cin >> n >> t;
  int a[n], b[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  while (r < n) {
    time += a[r++];
    if (time <= t) {
      books++;
    } else {
      time -= a[l++];
    }
  }
  cout << books;
  return 0;
}
