#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long m;
  cin >> n >> m;
  long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long sum = 0;
  int count = 0;
  int maxCount = 0;
  int i = 0, j = 0;
  while (i < n) {
    while (sum + arr[j] <= m && j < n) {
      sum += arr[j];
      count++;
      j++;
    }
    maxCount = max(count, maxCount);
    sum -= arr[i];
    i++;
    count--;
  }
  cout << maxCount << endl;
  return 0;
}
