program tickets;
var
i,n,f,max,temp,ans,p1:longint;
sz:array[1..1000000]of longint;
begin
assign(input,'tickets.in');
assign(output,'tickets.out');
reset(input);
rewrite(output);
readln(n,f);
for i:=1 to n do
read(sz[i]);
temp:=0;
p1:=0;
ans:=0;
max:=0;
for i:=1 to n do
begin
temp:=temp+sz[i];
ans:=ans+1;
while temp>f do
begin
p1:=p1+1;
ans:=ans-1;
temp:=temp-sz[p1];
end;
if ans>max then max:=ans;
end;
writeln(max);
close(input);
close(output);
end.