#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, t;
  cin >> n >> t;
  int start = 0;
  int end = 0;
  vector<int> numbers(n);
  for (int i = 0; i < n; ++i) {
    cin >> numbers[i];
  }
  long long cur_time = 0;
  int cur_books = 0;
  int max_books = 0;
  while (end < n) {
    if (numbers[end] + cur_time <= t) {
      ++cur_books;
      cur_time += numbers[end];
      ++end;
    } else {
      if (cur_books > max_books) max_books = cur_books;
      if (start == end) {
        ++start;
        ++end;
        continue;
      }
      cur_time -= numbers[start];
      ++start;
      cur_books -= 1;
    }
  }
  if (cur_books > max_books) max_books = cur_books;
  cout << max_books << endl;
  return 0;
}
