#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
template <typename T>
T gcd(T x, T y) {
  return y == 0 ? x : gcd(y, x % y);
}
template <typename T>
T lcm(const T &a, const T &b) {
  return (a * b) / gcd(a, b);
}
int n, t;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cout.precision(10);
  cout << fixed;
  cin >> n >> t;
  vector<long long int> arr(n + 1), prefix(n + 1);
  prefix[0] = 0;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  for (int i = 1; i < n + 1; i++) prefix[i] = prefix[i - 1] + arr[i];
  int b = 1, f = 1, s, ans = 0, temp = 1;
  while (f <= n) {
    s = prefix[f] - prefix[b - 1];
    while (s <= t) {
      if (temp > ans) ans = temp;
      f++;
      temp++;
      if (f > n) break;
      s = prefix[f] - prefix[b - 1];
    }
    while (s > t) {
      b++;
      temp--;
      if (b > f) f++, temp++;
      if (b > n) break;
      s = prefix[f] - prefix[b - 1];
    }
  }
  cout << ans;
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  return 0;
}
