import java.util.*;
 
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.nextLong();
    }
    long l = 0;
    Arrays.sort(H);
    for(int i=0; i<N-K; i++){
      l += H[i];
    }
    System.out.println(l);
  }
}
     import java.util.*; util.* java 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.nextLong();
    }
    long l = 0;
    Arrays.sort(H);
    for(int i=0; i<N-K; i++){
      l += H[i];
    }
    System.out.println(l);
  }
} 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.nextLong();
    }
    long l = 0;
    Arrays.sort(H);
    for(int i=0; i<N-K; i++){
      l += H[i];
    }
    System.out.println(l);
  } 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.nextLong();
    }
    long l = 0;
    Arrays.sort(H);
    for(int i=0; i<N-K; i++){
      l += H[i];
    }
    System.out.println(l);
  } 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.nextLong();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      H[i]=sc.nextLong();
    } {
      H[i]=sc.nextLong();
    } H[i]=sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc long l = 0; l 0 Arrays.sort(H) Arrays.sort Arrays H for(int i=0; i<N-K; i++){
      l += H[i];
    } int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
      l += H[i];
    } {
      l += H[i];
    } l += H[i] l H[i] H i System.out.println(l) System.out.println System.out System System.out l String[] args args
import java.util.*;
 
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.nextLong();
    }
    long l = 0;
    Arrays.sort(H);
    for(int i=0; i<N-K; i++){
      l += H[i];
    }
    System.out.println(l);
  }
}
    