#include <bits/stdc++.h>
using namespace std;
long long n, t, ans = 0;
vector<long long> v;
signed main() {
  cin >> n >> t;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  long long j = 0, sum = 0;
  for (long long i = 0; i < n; i++) {
    while (j < n && v[j] + sum <= t) {
      sum += v[j];
      j++;
    }
    ans = max(ans, j - i);
    sum -= v[i];
  }
  cout << ans << endl;
}
