import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
    Scanner scan = new Scanner(System.in);
    int N;
    ArrayList<Integer> H = new ArrayList<>();
    int K;
    int min;

    Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    }

    public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    }


    public static void main(String[] args){
        new Main();
    }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util public class Main{
    Scanner scan = new Scanner(System.in);
    int N;
    ArrayList<Integer> H = new ArrayList<>();
    int K;
    int min;

    Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    }

    public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    }


    public static void main(String[] args){
        new Main();
    }
} Main Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N; N ArrayList<Integer> H = new ArrayList<>(); H new ArrayList<>() int K; K int min; min Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    } Main {
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    } N = scan.nextInt() N scan.nextInt() scan.nextInt scan K = scan.nextInt() K scan.nextInt() scan.nextInt scan for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H.add(scan.nextInt());
        } {
            H.add(scan.nextInt());
        } H.add(scan.nextInt()) H.add H scan.nextInt() scan.nextInt scan System.out.println(minmize(N, K, H)) System.out.println System.out System System.out minmize(N, K, H) minmize N K H public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    } minmize {
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    } long sumhp = 0; sumhp 0 Collections.sort(H) Collections.sort Collections H for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        } int i = 0; int i = 0; i 0 i < H.size() - K i H.size() - K H.size() H.size H K i++ i++ i {
            sumhp += H.get(i);
        } {
            sumhp += H.get(i);
        } sumhp += H.get(i) sumhp H.get(i) H.get H i return sumhp; sumhp int N N int K K ArrayList<Integer> H H public static void main(String[] args){
        new Main();
    } main {
        new Main();
    } new Main() String[] args args public class Main{
    Scanner scan = new Scanner(System.in);
    int N;
    ArrayList<Integer> H = new ArrayList<>();
    int K;
    int min;

    Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    }

    public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    }


    public static void main(String[] args){
        new Main();
    }
} public class Main{
    Scanner scan = new Scanner(System.in);
    int N;
    ArrayList<Integer> H = new ArrayList<>();
    int K;
    int min;

    Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    }

    public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    }


    public static void main(String[] args){
        new Main();
    }
} Main
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
    Scanner scan = new Scanner(System.in);
    int N;
    ArrayList<Integer> H = new ArrayList<>();
    int K;
    int min;

    Main(){
        N = scan.nextInt();
        K = scan.nextInt();

        for(int i = 0; i < N; i++){
            H.add(scan.nextInt());
        }

        System.out.println(minmize(N, K, H));
        /*
        for(int i = 0; i < H.size(); i++){
            System.out.println(H.get(i));
        }*/
    }

    public long minmize(int N, int K, ArrayList<Integer> H){
        long sumhp = 0;
        Collections.sort(H);
        for(int i = 0; i < H.size() - K; i++){
            sumhp += H.get(i);
        }
        return sumhp;

    }


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