#include <bits/stdc++.h>
using namespace std;
long long sum[100001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, *t, a;
  long long ans = 0, x = 0, y = 0;
  cin >> n >> a;
  t = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    sum[i] = t[i];
    if (i) sum[i] += sum[i - 1];
  }
  long long l = 0, r = 0;
  while (true) {
    if (l)
      ans = sum[r] - sum[l - 1];
    else
      ans = sum[r];
    if (ans > a) {
      if (l == r) r++;
      l++;
    } else {
      x = r - l + 1;
      r++;
    }
    if (x > y) y = x;
    if (r == n) {
      cout << y;
      return 0;
    }
  }
}
