#include<stdio.h>
int main(void){
  int n,k;
  int a[1000],i,j,s;
  int man=1001,min=0;
    scanf("%d","%d",n,k);
  for(i=0;i<n;i++){
    scanf("%d",a[i]);
  }
   
     for(j=0;j<n-k;j++){
     if(man>a[j]){
       man=a[j];
        a[j]=0;
       }
   } 
  for(s=0;s<n;s++){
    min=min+a[j];
  }
  printf("%d",min)
return 0;
}