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();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    }
  } 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();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    }
  } Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    } main {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    } 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 int[] H = new int[N]; H new int[N] N long sum = 0; sum 0 long sum1 = 0; sum1 0 for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    } {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc sum = sum + H[i] sum sum + H[i] sum H[i] H i Arrays.sort(H) Arrays.sort Arrays H if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      } K < N && K != 0 K < N K N K != 0 K 0 {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        } int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
          sum1 = sum1 + H[i];
        } {
          sum1 = sum1 + H[i];
        } sum1 = sum1 + H[i] sum1 sum1 + H[i] sum1 H[i] H i System.out.println(sum1) System.out.println System.out System System.out sum1 if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      } K == 0 K 0 {
        System.out.println(sum);
      } System.out.println(sum) System.out.println System.out System System.out sum if (K >= N) {
        System.out.println("0");
      } K >= N K N {
        System.out.println("0");
      } System.out.println("0") System.out.println System.out System System.out "0" 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();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    }
  } public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    }
  } 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();
    int[] H = new int[N];
    long sum = 0;
    long sum1 = 0;

    for (int i = 0; i < N; i++) {
      H[i] = sc.nextInt();
      sum = sum + H[i];
    }

    Arrays.sort(H);

      if (K < N && K != 0) {
        for(int i=0;i<N-K;i++) {
          sum1 = sum1 + H[i];
        }
        System.out.println(sum1);
      } else if (K == 0) {
        System.out.println(sum);
      } else if (K >= N) {
        System.out.println("0");
      }
    }
  }