import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) final int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc final int K = Integer.parseInt(sc.next()); K Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long[] a = new long[N]; a new long[N] N long sum = 0; sum 0 for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next()); int i=0; int i=0; i 0 i<N i N i++ i++ i a[i] = Long.parseLong(sc.next()); a[i] = Long.parseLong(sc.next()) a[i] a i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc Arrays.sort(a) Arrays.sort Arrays a for (int i=0; i<N-K; i++)
            sum += a[i]; int i=0; int i=0; i 0 i<N-K i N-K N K i++ i++ i sum += a[i]; sum += a[i] sum a[i] a i out.println(sum) out.println out sum out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");
        
        final int N = Integer.parseInt(sc.next());
        final int K = Integer.parseInt(sc.next());
        long[] a = new long[N];
        long sum = 0;
        for (int i=0; i<N; i++)
            a[i] = Long.parseLong(sc.next());
        Arrays.sort(a);
        for (int i=0; i<N-K; i++)
            sum += a[i];
        out.println(sum);
        
        out.flush();
    }
}