program zht;
var
n,m,i,j,t,l,s,ss:longint;
a,c:array[0..1000000] of longint;
begin
{assign(input,'tickets.in');
assign(output,'tickets.out');
reset(input);
rewrite(output);}
readln(n,m);
for i:=1 to n doread(a[i]);
for i:=1 to n do
begint:=i and (-i);
for j:=i-t+1 to i do
c[i]:=c[i]+a[j];
end;
l:=1;
for i:=1 to n do
begin
if i+l>n then break;
while 1<2 do
begin
if l=n then
begin
writeln(l);
exit;
end;
s:=0;
ss:=0;
t:=i-1;
while t>0 do
begin
s:=s+c[t];
t:=t-(t and (-t));
end;
t:=i+l;
while t>0 do
begin
ss:=ss+c[t];
t:=t-(t and (-t));
end;
s:=ss-s;
//writeln(l,' ',i,' ',s);
if s<m then inc(l);
if s=m then
begin
inc(l);
break;
end;
if s>m then break;
end;
end;
writeln(l);
end.