#include <bits/stdc++.h>
using namespace std;
struct Point {
  int start;
  int end;
};
int main(int argc, const char* argv[]) {
  int n, t;
  cin >> n;
  cin >> t;
  int array[n];
  for (int i = 0; i < n; i++) {
    cin >> array[i];
  }
  int i = 0, j = 0, sum = 0, ans = 0;
  while (i < n) {
    sum += array[i];
    while (sum > t) {
      sum -= array[j];
      j++;
    }
    ans = max(ans, i - j + 1);
    i++;
  }
  cout << ans;
}
