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