#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k, t, l, m, q, i, j, s;
  cin >> n >> s;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  j = 0;
  long long max1 = 0;
  for (long long i = 0; i < n; i++) {
    while (sum + a[i] <= s && i < n) {
      sum += a[i];
      max1 = max(max1, i - j + 1);
      i++;
    }
    if (i == n) goto end;
    sum -= a[j];
    j++;
    sum += a[i];
    max1 = max(max1, i - j + 1);
  }
end:
  cout << max1;
  return 0;
}
