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