program t3(input,output);
var
n,m:integer;
data:array[1..500]of longint;
jl:array[1..500]of integer;
i,j,k,kk,max,q:longint;
begin
assign(input,'skill.in');
assign(output,'skill.out');
reset(input) ;
rewrite(output);
readln(n,m);
max:=0; k:=0;
fillchar(data,sizeof(data),0);
for i:= 1 to n do
for j:= 1 to n+1-i do
begin
inc(k);
read(input,data[k]);
end;
close(input);
for i:= 1 to n do
jl[i]:=1; kk:=n;
for i:= 2 to n do
begin
for j:= 1 to n +1-i do
begin
inc(kk);
data[kk]:=data[kk-n-1+i-1]+data[kk-n-1+i];
jl[kk]:=jl[kk-n-1+i-1] +jl[kk-n+i-1]+1;
end;
if m mod jl[kk] <=(n+1-i ) then
begin
max:=0;
for q:= kk downto kk-(n +1-i) do
if max< data[q] then max:=data[q];
max:=max+data[n]*(m-jl[q]);
writeln(max);
close(output);
halt;
end;
end;
end.