import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[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[] hl = new int[n]; hl new int[n] n for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            hl[i] = sc.nextInt();
        } {
            hl[i] = sc.nextInt();
        } hl[i] = sc.nextInt() hl[i] hl i sc.nextInt() sc.nextInt sc Arrays.sort(hl) Arrays.sort Arrays hl long ans = 0; ans 0 for(int i = 0; i < n-k; i++){
            ans += hl[i];
        } int i = 0; int i = 0; i 0 i < n-k i n-k n k i++ i++ i {
            ans += hl[i];
        } {
            ans += hl[i];
        } ans += hl[i] ans hl[i] hl 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] hl = new int[n];
        for(int i = 0; i < n; i++){
            hl[i] = sc.nextInt();
        }
        Arrays.sort(hl);
        long ans = 0;
            for(int i = 0; i < n-k; i++){
            ans += hl[i];
        }
        System.out.println(ans);
    }
}