var
n,v,i,j,total,max:longint;
a:array[0..2000000]of longint;
begin
assign(input,'tickets.in'); reset(input);
assign(output,'tickets.out'); rewrite(output);
readln(n,v);
for i:=1 to n do read(a[i]);
i:=1;
j:=0;
total:=0;
max:=-maxlongint;
while j<=n do
begin
repeat
inc(total,a[j]);
inc(j);
until (total+a[j]>v)or(j>n);
if j-i>max then max:=j-i;
dec(total,a[i]);
inc(i);
end;
writeln(max);
close(input);
close(output);
end.