const   filein='A.in';
        fileout='A.out';

var i,j,k,l,m,n         :integer;
    sum                 :int64;
    a                   :array[1..1000000] of integer;

procedure readf;
begin
 assign(input,filein);
 reset(input);
 read(n,k);
 for i:=1 to n do
  read(a[i]);
 close(input); 
end;

procedure main;
begin
m:=200000;
 for i:=1 to k do begin
  for j:=1 to n do
   if a[j]<m then begin
    m:=a[j];
    l:=j;
   end;
  a[l]:=200000;
  m:=200000;
 end;
end;

procedure vivod;
begin
 assign(output,fileout);
 rewrite(output);
 sum:=0;
 for i:=1 to n do
  if a[i]<>200000 then begin
   sum:=sum+a[i];
  end;
 write(sum); 
 close(output); 
end;

begin
 readf;
 main;
 vivod;
end.
