import java.util.*;
import java.util.ArrayList;
import java.util.Collection;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Collection; Collection 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();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    } 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 int[] H = new int[N]; H new int[N] N int[] h = new int[N]; h new int[N] N long ans = 0; ans 0 ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            H[i] = sc.nextInt();
            list.add(H[i]);
        } {
            H[i] = sc.nextInt();
            list.add(H[i]);
        } H[i] = sc.nextInt() H[i] H i sc.nextInt() sc.nextInt sc list.add(H[i]) list.add list H[i] H i Collections.sort(list) Collections.sort Collections list for(int i=0; i<N; i++){
            h[i] = list.get(i);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            h[i] = list.get(i);
        } {
            h[i] = list.get(i);
        } h[i] = list.get(i) h[i] h i list.get(i) list.get list i for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        } int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i {
            ans = ans + h[i];
        } {
            ans = ans + h[i];
        } ans = ans + h[i] ans ans + h[i] ans h[i] h i System.out.println(ans) System.out.println System.out System System.out ans 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();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] H = new int[N];
        int[] h = new int[N];
        long ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();

        for(int i=0; i<N; i++){
            H[i] = sc.nextInt();
            list.add(H[i]);
        }
        Collections.sort(list);
        for(int i=0; i<N; i++){
            h[i] = list.get(i);
        }
        for(int i=0; i<N-K; i++){
            ans = ans + h[i];
        }
        System.out.println(ans);
    }
}