import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  }
} Main public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  } main {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc long H[] = new long[N]; H new long[N] N for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      H[i] = sc.nextInt();
    } {
      H[i] = sc.nextInt();
    } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc Arrays.sort(H) Arrays.sort Arrays H long num = 0; num 0 if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    } K >= N K N {
      System.out.println(0);
    } System.out.println(0) System.out.println System.out System System.out 0 {
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    } for(int i=0; i< N-K; i++){
        num += H[i];
      } int i=0; int i=0; i 0 i< N-K i N-K N K i++ i++ i {
        num += H[i];
      } {
        num += H[i];
      } num += H[i] num H[i] H i System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  }
} public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    long H[] = new long[N]; 
    for(int i=0; i<N; i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);
    
    long num = 0;
    if(K >= N){
      System.out.println(0);
    }
    else{
      for(int i=0; i< N-K; i++){
        num += H[i];
      }
      System.out.println(num);
    }
    
  }
}