program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var a: array [1..100000]of longint;
    i,j,k,n,m,x: longint;
    s:int64;
begin
  assign(input,'a.in');
  reset(input);
  assign(output,'a.out');
  rewrite(output);
  read(n);
  read(k);
  for i:=1 to n do begin
   read(x);
   inc(a[x]);
   if(x>m) then m:=x;
   s:=s+x;
  end;
  i:=1 ;
  while (j<=k) do begin
   if(a[i] > 0) then begin
    dec(a[i]);
    inc(j);
    s:=s-i;
   end
   else inc(i);
  end;
  writeln(s);
  close(input);
  close(output);
end.
