#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
int N, T;
int A[MAX];
int main() {
  cin >> N >> T;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    int t;
    cin >> t;
    sum += t;
    A[i] = sum;
  }
  int best = 0;
  for (int i = 0; i < N; i++) {
    int idx = upper_bound(A, A + N + 1, A[i] + T) - A - i - 1;
    best = max(best, idx);
  }
  cout << best;
  return 0;
}
