include <bits/stdc++.h>
using namespace std;
#define gc() (p1==p2&&(p1=bf,p2=bf+fread(bf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char bf[1 << 21], *p1(bf), *p2(bf);
template<class t=""> void read(T& x) {
char c(gc()), neg(0); T t(0);
for (; c != EOF && !isdigit(c); c = gc()) neg = '-' == c;
for (; isdigit(c); c = gc()) t = 10 * t + (c & 15);
x = neg ? -t : t;
}
int main(){
int n,k;read(n);read(k);
int sum = 0;
int res = 0;
int rec[n];rec[0]=0;
for(int i = 1;i <= n;i++){
int x;read(x);
sum += x;
int j = lower_bound(rec,rec+i,sum - k)-rec;
res = max(res,i - j);
rec[i] = max(sum,rec[i-1]);
}
printf("%d\n",res);
}</class>