#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, sum = 0;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int i = 0, j = 0, maxi = 0;
  while (j < n) {
    sum = sum + arr[j];
    if (sum <= k) {
      maxi = max(maxi, j - i + 1);
      j++;
    } else if (sum > k) {
      while (sum > k) {
        sum = sum - arr[i];
        i++;
      }
      j++;
    }
  }
  cout << maxi << endl;
  return 0;
}
