import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int k = scanner.nextInt(); k scanner.nextInt() scanner.nextInt scanner int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) arr[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i arr[i] = scanner.nextInt(); arr[i] = scanner.nextInt() arr[i] arr i scanner.nextInt() scanner.nextInt scanner Arrays.sort(arr) Arrays.sort Arrays arr if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        } k >= n k n System.out.println(0) System.out.println System.out System System.out 0 {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        } long sum = 0; sum 0 for (int i = 0; i < n - k; i++) sum += arr[i]; int i = 0; int i = 0; i 0 i < n - k i n - k n k i++ i++ i sum += arr[i]; sum += arr[i] sum arr[i] arr i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        if (k >= n) System.out.println(0);
        else {
            long sum = 0;
            for (int i = 0; i < n - k; i++) sum += arr[i];
            System.out.println(sum);
        }
    }
}
