#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, t;
  cin >> n >> t;
  long long a[n], i, j = 0, x = 0, mx = 0, sum = 0;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    for (; j < n;) {
      if (sum + a[j] <= t)
        sum += a[j];
      else {
        sum -= a[i];
        break;
      }
      j++;
    }
    mx = max(mx, j - i);
  }
  cout << mx << endl;
  return 0;
}
