#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, v[100009], sum = 0, i, j = 0, c = 0;
  cin >> n >> t;
  for (i = 0; i < n; ++i) {
    cin >> v[i];
    sum += v[i];
    while (sum > t) sum -= v[j++];
    if (i - j + 1 > c) c = i - j + 1;
  }
  cout << c;
  return 0;
}
