program river;
var f,a:array[0..2500] of int64;
num,n,m,q:int64;
i,j:longint;
function min(a,b:int64):int64;
begin
if a>b then exit(b) else exit(a);
end;
begin
assign(input,'cowriver.in'); reset(input);
assign(output,'cowriver.out'); rewrite(output);
readln(n,m);
num:=m;
for i:=1 to n do
begin
readln(q);
inc(num,q);
a[i]:=num;
end;
for i:=1 to n do f[i]:=maxlongint;
for i:=1 to n-1 do
for j:=0 to i-1 do
f[i]:=min(f[i],f[j]+a[i-j]+m);
for j:=0 to n-1 do
f[n]:=min(f[n],f[j]+a[n-j]);
writeln(f[n]);
close(input); close(output);
end.