#include <bits/stdc++.h>
using namespace std;
void file() {}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  file();
  int n, m, sum(0), start(0), counter(0);
  ;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (sum <= m)
      counter++;
    else {
      sum -= a[start];
      start++;
    }
  }
  cout << counter << '\n';
  return 0;
}
