#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  int* time = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> time[i];
  }
  int sum = 0, count = 0;
  int ans = INT_MIN;
  for (int i = 0; i < n; i++) {
    if (sum + time[i] <= t) {
      sum += time[i];
      count++;
    } else {
      sum = sum - time[i - count] + time[i];
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
  return 0;
}
