#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mini(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool maxi(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  long long t;
  cin >> t;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  int ans = 0, r = -1;
  for (int i = 0; i < (int)(n); i++) {
    while (r + 1 < n && t >= a[r + 1]) t -= a[++r];
    maxi(ans, r - i + 1);
    if (r == i - 1)
      ++r;
    else
      t += a[i];
  }
  cout << ans << "\n";
}
