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