var n,m,i,j,s,h:longint;
a,b:array[0..10000] of longint;
begin
read(n,m);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
read(b[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if b[j]>b[i] then
begin
h:=b[i];b[i]:=b[j];b[j]:=h;
h:=a[i];a[i]:=a[j];a[j]:=h;
end else if (b[j]=b[i]) and (a[j]>a[i]) then
begin
h:=b[i];b[i]:=b[j];b[j]:=h;
h:=a[i];a[i]:=a[j];a[j]:=h;
end;
j:=m;
for i:=1 to n do
begin
inc(s,a[i]+b[i]*(j-1));
dec(j);
if j=0 then break;
end;
write(s);
end.