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