#include <bits/stdc++.h>
int mod = 1000000007;
const int M = INT_MAX;
using namespace std;
int powb(int x, int y) {
  int res = 1;
  x = x % M;
  while (y > 0) {
    if (y % 2) res = (res * x) % M;
    y /= 2;
    x = (x * x) % M;
  }
  return res;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int solve() {
  int n, t, s = 0, x, s1 = 0, i, j;
  cin >> n >> t;
  vector<int> v(2 * n);
  for (i = 0; i < n; i++) {
    cin >> x;
    s1 += x;
    v[i] = x;
    v[i + n] = x;
  }
  if (s1 <= t) return n;
  int max = 0;
  x = 0;
  for (i = 0; i < 2 * n; i++) {
    s += v[i];
    if (s > t) {
      s -= v[i];
      break;
    }
    x++;
    if (x > max) max = x;
  }
  for (i = 1; i < n; i++) {
    s -= v[i - 1];
    x--;
    for (j = i + x; j < n; j++) {
      s += v[j];
      if (s > t) {
        s -= v[j];
        break;
      }
      x++;
      if (x > max) max = x;
    }
    if (j == n - 1) break;
  }
  return max;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << solve();
  return 0;
}
