#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, ans = 0;
  cin >> n >> t;
  int arr[n];
  cin >> arr[0];
  for (int i = 1; i < n; i++) {
    cin >> arr[i], arr[i] += arr[i - 1];
  }
  int j = 0, r = 0;
  for (int i = 0; i < n; i++) {
    if (i) r = arr[i - 1];
    while (j + 1 < n && arr[j + 1] - r <= t) j++;
    if (j == i)
      ans = max(ans, t >= arr[i] - r ? 1 : 0);
    else
      ans = max(ans, (j - i) + 1);
  }
  cout << ans << endl;
  return 0;
}
