#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, t;
  cin >> n >> t;
  vector<long long int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  b[0] = a[0];
  for (int i = 1; i < n; i++) {
    b[i] = b[i - 1] + a[i];
  }
  long long int low = 0, high = n, books = 0, m = 0;
  for (int i = 0; i < n; i++) {
    low = i;
    high = n - 1;
    while (low <= high) {
      long long int mid = (low + high) / 2;
      if (b[mid] - b[i] + a[i] > t) {
        high = mid - 1;
      }
      if (high < low) {
        break;
      }
      if (mid == n - 1) {
        books = mid - i + 1;
        m = max(books, m);
        break;
      }
      if (b[mid] - b[i] + a[i] == t) {
        books = mid - i + 1;
        m = max(books, m);
        break;
      }
      if (b[mid] - b[i] + a[i] < t && b[mid + 1] - b[i] + a[i] > t) {
        books = mid - i + 1;
        m = max(books, m);
        break;
      }
      if (b[mid] - b[i] + a[i] < t) {
        low = mid + 1;
      }
    }
  }
  cout << m;
  return 0;
}
