($n,$x)=glob<>; @a=glob<>; $a=-$n; for$b(-$n..$n-1){ $c+=$a[$b]; while($b-$a>$n||$c>$x){ $c-=$a[$a++]; } $d=$c if$d<$c; } print$d+0;