var n, c, i, j, tmp, sol : longint;
    floors : array [1..1000] of longint;
    f : text;

begin
  assign(f, 'lift.in');
  reset(f);
  readln(f, n, c);
  for i := 1 to n do
    read(f, floors[i]);
  close(f);

  for i := n - 1 downto 1 do
    for j := 1 to i do
      if floors[j] > floors[j + 1]
        then begin
               tmp := floors[j];
               floors[j] := floors[j + 1];
               floors[j + 1] := tmp;
             end;

  sol := floors[n];
  i := n - c;
  while i > 0 do
    begin
      sol := sol + 2 * floors[i];
      i := i - c;
    end;

  assign(f, 'lift.out');
  rewrite(f);
  writeln(f, sol);
  close(f);
end.
