#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
void H2A() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long l = 0, r = 0, counter = 0;
  long long sum = 0;
  while (r < n) {
    if (sum < k) {
      while (sum < k && r < n) sum += arr[r++], counter++;
      if (sum > k) sum -= arr[--r], counter--;
    }
    ans = max(counter, ans);
    if (l == r)
      l++, r++;
    else
      sum -= arr[l++], counter--;
  }
  if (sum < k) ans = max(ans, counter);
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) H2A();
}
