#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long ans = 1;
  for (long long i = 1; i <= b; i++) {
    ans *= a;
  }
  return ans;
}
long long make(long long x) {
  long long ck = 1, sum = 0;
  for (long long i = 1; i <= x; i++) ck *= 2, sum += ck;
  return sum;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  long long sum = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long left = 0, right = n - 1, mxx = 0, ans = 0;
  for (long long i = 0; i < n; i++) {
    sum += a[i];
    ans++;
    while (sum > k) {
      sum -= a[left];
      left++;
      ans--;
    }
    mxx = max(mxx, ans);
  }
  cout << mxx << endl;
}
