import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        int N,K;
        N = Integer.parseInt(scanner.next());
        K = Integer.parseInt(scanner.next());

        long[] H = new long[N];
        for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        }

        Arrays.sort(H);

        long result = 0;

        for(int i=0;i<N-K;i++){
            result += H[i];
        }

        System.out.println(result);
    }
} import java.util.*; util.* java class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        int N,K;
        N = Integer.parseInt(scanner.next());
        K = Integer.parseInt(scanner.next());

        long[] H = new long[N];
        for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        }

        Arrays.sort(H);

        long result = 0;

        for(int i=0;i<N-K;i++){
            result += H[i];
        }

        System.out.println(result);
    }
} Main public static void main(String args[]) throws Exception{
        Main main = new Main();
    } main {
        Main main = new Main();
    } Main main = new Main(); main new Main() String args[] args public Main(){
        Scanner scanner = new Scanner(System.in);
        int N,K;
        N = Integer.parseInt(scanner.next());
        K = Integer.parseInt(scanner.next());

        long[] H = new long[N];
        for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        }

        Arrays.sort(H);

        long result = 0;

        for(int i=0;i<N-K;i++){
            result += H[i];
        }

        System.out.println(result);
    } Main {
        Scanner scanner = new Scanner(System.in);
        int N,K;
        N = Integer.parseInt(scanner.next());
        K = Integer.parseInt(scanner.next());

        long[] H = new long[N];
        for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        }

        Arrays.sort(H);

        long result = 0;

        for(int i=0;i<N-K;i++){
            result += H[i];
        }

        System.out.println(result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N N K; K N = Integer.parseInt(scanner.next()) N Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner K = Integer.parseInt(scanner.next()) K Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner long[] H = new long[N]; H new long[N] N for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            H[i] = scanner.nextLong();
        } {
            H[i] = scanner.nextLong();
        } H[i] = scanner.nextLong() H[i] H i scanner.nextLong() scanner.nextLong scanner Arrays.sort(H) Arrays.sort Arrays H long result = 0; result 0 for(int i=0;i<N-K;i++){
            result += H[i];
        } int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
            result += H[i];
        } {
            result += H[i];
        } result += H[i] result H[i] H i System.out.println(result) System.out.println System.out System System.out result
import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        int N,K;
        N = Integer.parseInt(scanner.next());
        K = Integer.parseInt(scanner.next());

        long[] H = new long[N];
        for(int i=0;i<N;i++){
            H[i] = scanner.nextLong();
        }

        Arrays.sort(H);

        long result = 0;

        for(int i=0;i<N-K;i++){
            result += H[i];
        }

        System.out.println(result);
    }
}
