program tickets(input,output);
var
a:array[1..1000000]of integer;
n,f,p:longint;
ans,head,i,j,z:longint;
begin
assign(input,'tickets.in');
reset(input);
readln(n,f);
for i:=1 to n do read(a[i]);
close(input);
p:=0;
head:=1;
for i:=1 to n do
begin
if a[i]+p<=f then
begin
p:=p+a[i];
inc(z);
if z>ans then ans:=z;
end
else
begin
while (p+a[i]>f) do
begin
p:=p-a[head];
inc(head);
dec(z);
end;
p:=p+a[i];
inc(z);
if z>ans then ans:=z;
end;
end;
assign(output,'tickets.out');
rewrite(output);
writeln(ans);
close(output);
end.