import java.util.Arrays;
import java.util.BitSet;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    }
} import java.util.Arrays; Arrays java.util import java.util.BitSet; BitSet java.util import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    } 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 sc.nextLine() sc.nextLine sc int[] H = new int[N]; H new int[N] N for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < H.length i H.length H H.length i++ i++ i {
            H[i] = sc.nextInt();
        } {
            H[i] = sc.nextInt();
        } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc if (K >= N) {
            System.out.println(0);
            return;
        } K >= N K N {
            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 long sumA = 0; sumA 0 for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        } int i = N - K - 1; int i = N - K - 1; i N - K - 1 N - K - 1 N K 1 i >= 0 i 0 i-- i-- i {
            sumA += H[i];
        } {
            sumA += H[i];
        } sumA += H[i] sumA H[i] H i System.out.println(sumA) System.out.println System.out System System.out sumA 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();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        int[] H = new int[N];
        for (int i = 0; i < H.length; i++) {
            H[i] = sc.nextInt();
        }
        if (K >= N) {
            System.out.println(0);
            return;
        }
        Arrays.sort(H);
        long sumA = 0;
        for (int i = N - K - 1; i >= 0; i--) {
            sumA += H[i];
        }
        System.out.println(sumA);
    }
} Main
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;

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