#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  long long t;
  long long n, i, x, k, high, low, mid, ans = 0, a;
  cin >> n >> k;
  vector<long long> v(n + 2), pre(n + 2);
  for (i = 1; i <= n; i++) {
    cin >> v[i];
  }
  pre[0] = 0;
  for (i = 1; i <= n; i++) {
    pre[i] = pre[i - 1] + v[i];
  }
  for (i = 1; i <= n; i++) {
    low = i;
    high = n;
    a = -1;
    while (low <= high) {
      mid = (high + low) / 2;
      if (pre[mid] - pre[i - 1] <= k) {
        low = mid + 1;
        a = mid;
      } else {
        high = mid - 1;
      }
    }
    if (a != -1) {
      ans = max(ans, a - i + 1);
    }
  }
  cout << ans << endl;
}
