
import java.util.Arrays;
import java.util.Scanner;

public 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 res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner 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[] h = new long[n];
        
        for(int i = 0; i < n; i++){
            h[i] = sc.nextLong();
        }

        long res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    }
} 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 res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    } 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 res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    } 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 res = 0; res 0 if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        } n<=k n k {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        } Arrays.sort(h) Arrays.sort Arrays h for(int i = 0; i < n-k; i++){
                res+=h[i];
            } int i = 0; int i = 0; i 0 i < n-k i n-k n k i++ i++ i {
                res+=h[i];
            } {
                res+=h[i];
            } res+=h[i] res h[i] h i System.out.println(res) System.out.println System.out System System.out res 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[] h = new long[n];
        
        for(int i = 0; i < n; i++){
            h[i] = sc.nextLong();
        }

        long res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    }
} public 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 res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    }
} Main

import java.util.Arrays;
import java.util.Scanner;

public 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 res = 0;
        if(n<=k){
            System.out.println(0);
        }else {
            Arrays.sort(h);
            for(int i = 0; i < n-k; i++){
                res+=h[i];
            }
            System.out.println(res);
        }
    }
}