program tickets(input,output);
var
best,sum,st,n,f,i:longint;
nb:array[1..1000000]of integer;
begin
assign(input,'tickets.in');
reset(input);
assign(output,'tickets.out');
rewrite(output);
readln(n,f);
st:=1;
sum:=0;
best:=0;
for i:=1 to n do
begin
read(nb[i]);
sum:=sum+nb[i];
while (sum>f)and(st<=i) do
begin
sum:=sum-nb[st];
inc(st);
end;
if i-st+1>best then
best:=i-st+1;
end;
writeln(best);
close(input);
close(output);
end.