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