program zzn;
var
i,j,n,f:longint;
s:array[0..1000000]of longint;
procedure init;
begin
assign(input,'tickets.in');
reset(input);
assign(output,'tickets.out');
rewrite(output);
readln(n,f);
s[0]:=0;
for i:=1 to n do
begin
read(j);
s[i]:=s[i-1]+j;
end;
end;
procedure closef;
begin
close(input);
close(output);
end;
function sum(x,y:longint):longint;
begin
exit(s[y]-s[x-1]);
end;
procedure main;
var
l,r,ss,ans:longint;
flg:boolean;
begin
l:=1;r:=n;
flg:=false;
ans:=0;
while not(flg) do
begin
if sum(l,r)<=f then
begin
flg:=true;
ans:=r-l+1;
break;
end;
if sum(l+1,r)<sum(l,r-1) then inc(l) else dec(r);
if l>r then break;
end;
writeln(ans);
end;
begin
init;
main;
closef;
end.