#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, i, j;
  cin >> n >> t;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int max = 0, sum = 0, c = 0, prev = -1;
  for (i = 0; i < n; i++) {
    sum = sum + a[i];
    if (sum <= t) {
      c++;
      if (prev == -1) prev = i;
      if (c > max) max = c;
      continue;
    } else {
      if (prev == -1) {
        sum = 0;
        continue;
      }
      j = prev;
      c++;
      while (j < i && sum > t) {
        sum = sum - a[j];
        c--;
        if (sum <= t) {
          prev = j + 1;
          break;
        } else
          j = j + 1;
      }
      if (j == i) {
        if (a[j] > t) {
          c = 0;
          prev = -1;
          sum = 0;
        } else {
          c = 1;
          prev = j;
          if (c > max) max = c;
        }
      }
    }
  }
  cout << max;
  return 0;
}
