var
  a : array [1..10000] of integer;
  m,n,s,k,i,j,index : longint;
begin
  assign(input,'a.in'); reset(input);
  assign(output,'a.out'); rewrite(output);

  read(n,k);
  for i:=1 to n do
   read(a[i]);

  for i:=1 to k do
   begin
    m:=1000000000; index:=0;
    for j:=1 to n do
    if (m>a[j]) and (a[j]>-1) then
     begin
      m:=a[j];
      index:=j;
     end;
    a[index]:=-1;
   end;

  s:=0;
  for i:=1 to n do
   if a[i]>=0 then
   s:=s+a[i];

  write(s);
  close(input);
  close(output);
end.