#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
int main() {
  scanf("%d%d", &n, &m);
  v.resize(n);
  vector<int> sum(n);
  int prev = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    sum[i] = v[i] + prev;
    prev = sum[i];
  }
  int ans = INT_MIN;
  int prev0 = 0;
  for (int i = 0; i < n; i++) {
    int loc = upper_bound(sum.begin() + i, sum.end(), m + prev0) - sum.begin();
    ans = max(ans, loc - i);
    prev0 = sum[i];
  }
  cout << ans << endl;
}
