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

class Main{

    public static void main(String[] args) {
        // write your code here

        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long k = sc.nextInt();

        long[] arr = new long[(int)n];

        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        }

        Arrays.sort(arr);

        if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        }


    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main{

    public static void main(String[] args) {
        // write your code here

        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long k = sc.nextInt();

        long[] arr = new long[(int)n];

        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        }

        Arrays.sort(arr);

        if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        }


    }
} Main public static void main(String[] args) {
        // write your code here

        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long k = sc.nextInt();

        long[] arr = new long[(int)n];

        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        }

        Arrays.sort(arr);

        if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        }


    } main {
        // write your code here

        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long k = sc.nextInt();

        long[] arr = new long[(int)n];

        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        }

        Arrays.sort(arr);

        if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        }


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long k = sc.nextInt(); k sc.nextInt() sc.nextInt sc long[] arr = new long[(int)n]; arr new long[(int)n] (int)n for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        } int i = 0; int i = 0; i 0 i <arr.length i arr.length arr arr.length i++ i++ i {
            arr[i]=sc.nextInt();
        } {
            arr[i]=sc.nextInt();
        } arr[i]=sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc Arrays.sort(arr) Arrays.sort Arrays arr if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        } k>=n k n {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        } long monleft = n-k; monleft n-k n k long sum=0; sum 0 for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            } int i = 0; int i = 0; i 0 i <(monleft) i (monleft) i++ i++ i {
                sum+=arr[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
import java.util.Arrays;
import java.util.Scanner;

class Main{

    public static void main(String[] args) {
        // write your code here

        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long k = sc.nextInt();

        long[] arr = new long[(int)n];

        for (int i = 0; i <arr.length ; i++) {
            arr[i]=sc.nextInt();
        }

        Arrays.sort(arr);

        if(k>=n)
        {
            System.out.println(0);
        }
        else
        {
            long monleft = n-k;
            //System.out.println(monleft);
            long sum=0;

            for (int i = 0; i <(monleft) ; i++)
            {
                sum+=arr[i];
            }

            System.out.println(sum);

        }


    }
}
