#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, sum = 0, ans = 0, j = 0;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    while (j < n && sum + arr[j] <= k) {
      sum += arr[j];
      j++;
    }
    ans = max(ans, j - i);
    sum -= arr[i];
  }
  cout << ans << endl;
  return 0;
}
