program A;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  fin,fout : textfile;
  i,n,k,b,j : longint;
  mas : array [1..100000] of longint;
begin
  assign(fin,'a.in');
  reset(fin);
  assign(fout,'a.out');
  rewrite(fout);
    read(fin,n); read(fin,k);
    for i:=1 to n do
       read(fin,mas[i]);
    for i:=1 to k do
      begin
        b:=100000;
        for j:=1 to n do
          begin
            if (mas[j]<b) and (mas[j]<>0) then b:=mas[j];
          end;
        for j:=1 to n do
          if b=mas[j] then
            begin
              mas[j]:=0;
              break;
            end;
      end;
    b:=0;
    for i:=1 to n do
      begin
        if mas[i]<>0 then b:=b+mas[i];
      end;
    writeln;
    write(fout,b);
  close(fout);
  close(fin);
end.
