program maipiao;
var
k,he,i,max,weizhi,n,f:longint;
a,sum:array[0..1000000]of longint;
procedure chazhao(x,y:longint);
begin
k:=(x+y) div 2;
he:=sum[k]-sum[i-1];
if x=y then
begin
if sum[x]-sum[i-1]<=f then
weizhi:=x
else
weizhi:=0;
exit
end;
if x=y-1 then
begin
if sum[y]-sum[i-1]<=f then
begin
weizhi:=y;
exit
end
else
begin
if he<=f then
begin
weizhi:=x;
exit
end
else
begin
weizhi:=0;
exit
end
end
end;
if he<=f then
chazhao(k,y)
else
chazhao(x,k)
end;
begin
assign (input,'tickets.in');
reset (input);
assign (output,'tickets.out');
rewrite (output);
readln (n,f);
for i:=1 to n do
begin
read(a[i]);
sum[i]:=sum[i-1]+a[i]
end;
max:=0;
for i:=1 to n do
begin
chazhao(i,n);
if weizhi<>0 then
if weizhi-i+1>max then
max:=weizhi-i+1
end;
writeln (max);
close (input);
close (output)
end.