import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    }
} Main public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    } main {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    } java.util.Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int k = input.nextInt(); k input.nextInt() input.nextInt input int[] h = new int[n]; h new int[n] n for (int i = 0; i < n; i++) h[i] = input.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i h[i] = input.nextInt(); h[i] = input.nextInt() h[i] h i input.nextInt() input.nextInt input Arrays.sort(h) Arrays.sort Arrays h long r = 0; r 0 for (int i = 0; i < n - k; i++) r += h[i]; int i = 0; int i = 0; i 0 i < n - k i n - k n k i++ i++ i r += h[i]; r += h[i] r h[i] h i System.out.println(r) System.out.println System.out System System.out r String[] args args public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    }
} public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    }
} Main
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) h[i] = input.nextInt();
        Arrays.sort(h);
        long r = 0;
        for (int i = 0; i < n - k; i++) r += h[i];
        System.out.println(r);
    }
}
