import java.io.*;
import java.util.*;

public class Main {
    PrintWriter out = new PrintWriter(System.out);
    // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    }
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {
    PrintWriter out = new PrintWriter(System.out);
    // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    }
} Main PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    } main {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    } Main main = new Main(); main new Main() System.out.println(main.solve()) System.out.println System.out System System.out main.solve() main.solve main String[] args args long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    } solve {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for(int i=0; i<n; i++) a[i] = sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i] = sc.nextInt(); a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sc.close() sc.close sc Arrays.sort(a) Arrays.sort Arrays a long ans = 0; ans 0 for(int i=0;i<n-k;i++){
            ans += a[i];
        } int i=0; int i=0; i 0 i<n-k i n-k n k i++ i++ i {
            ans += a[i];
        } {
            ans += a[i];
        } ans += a[i] ans a[i] a i return ans; ans public class Main {
    PrintWriter out = new PrintWriter(System.out);
    // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    }
} public class Main {
    PrintWriter out = new PrintWriter(System.out);
    // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    }
} Main
import java.io.*;
import java.util.*;

public class Main {
    PrintWriter out = new PrintWriter(System.out);
    // no self-loop or multiple edges
    public static void main(String[] args) throws Exception {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) a[i] = sc.nextInt();
        sc.close();
        Arrays.sort(a);
        long ans = 0;
        for(int i=0;i<n-k;i++){
            ans += a[i];
        }
        return ans;
    }
}

