#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return a > b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const long long INF = (long long)(1e17);
const double PI = 3.141592653589793;
long long dx[4] = {-1, 0, 1, 0};
long long dy[4] = {0, 1, 0, -1};
string path = "URDL";
void solve() {
  long long n, t, cnt = 0;
  cin >> n >> t;
  long long arr[n];
  long long pre[n];
  for (long long& e : arr) cin >> e;
  pre[0] = arr[0];
  for (long long i = 1; i < n; i++) pre[i] = pre[i - 1] + arr[i];
  long long l = 0, r = 0;
  long long temp = 0;
  while (l < n and r < n) {
    if (pre[r] - pre[l] + arr[l] <= t) {
      temp = r - l + 1;
      r++;
    } else {
      cnt = max(temp, cnt);
      l++;
      temp = 0;
    }
  }
  cout << max(cnt, temp) << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  solve();
  return 0;
}
