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

public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair {
    int x;
    long y;

    Pair(int x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
} Main private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    } solver {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc Integer arr[] = new Integer[n]; arr new Integer[n] n for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<n i n 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 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] sum arr[i] arr i out.println(sum) out.println out sum InputReader sc sc PrintWriter out out private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    } isprime {
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    } if(x==2)
            return true; x==2 x 2 return true; true int sqs = (int)Math.sqrt(x); sqs (int)Math.sqrt(x) Math.sqrt Math x for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        } int i=2; int i=2; i 2 i<=sqs i sqs i++ i++ i {
            if(x%i==0)
                return false;
        } {
            if(x%i==0)
                return false;
        } if(x%i==0)
                return false; x%i==0 x%i x i 0 return false; false return true; true int x x private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    } gcd {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    } if (b == 0)
            return a;
        else
            return gcd (b, a % b); b == 0 b 0 return a; a return gcd (b, a % b); gcd (b, a % b) gcd b a % b a b int a a int b b private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    } helper {
        long ans = (x * (x-1))/2;
        return ans;
    } long ans = (x * (x-1))/2; ans (x * (x-1))/2 (x * (x-1)) x (x-1) x 1 2 return ans; ans long x x public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) solver(in,out) solver in out out.close() out.close out String[] args args static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    } InputReader public BufferedReader reader; reader public StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        } readIntArray {
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        } int arr[] = new int[n]; arr new int[n] n for(int i=0;i<n;i++) arr[i] = nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i arr[i] = nextInt(); arr[i] = nextInt() arr[i] arr i nextInt() nextInt return arr; arr int n n class Pair {
    int x;
    long y;

    Pair(int x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
} Pair int x; x long y; y Pair(int x, long y) {
        this.x = x;
        this.y = y;
    } Pair {
        this.x = x;
        this.y = y;
    } this.x = x this.x this this.x x this.y = y this.y this this.y y int x x long y y @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    } equals {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    } Pair pair = (Pair) o; pair (Pair) o return this.x < pair.x && this.y==pair.y; this.x < pair.x && this.y==pair.y this.x < pair.x this.x this this.x pair.x pair pair.x this.y==pair.y this.y this this.y pair.y pair pair.y Object o o @Override
    public int hashCode() {
        return Objects.hash(x, y);
    } hashCode {
        return Objects.hash(x, y);
    } return Objects.hash(x, y); Objects.hash(x, y) Objects.hash Objects x y public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
} public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
} Main

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

public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer arr[] = new Integer[n];
        for(int i=0; i<n; i++){
           arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for(int i=0; i<n-k; i++){
            sum += arr[i];
        }

        out.println(sum);
    }
    private static boolean isprime(int x){
        if(x==2)
            return true;
        int sqs = (int)Math.sqrt(x);
        for(int i=2; i<=sqs; i++){
            if(x%i==0)
                return false;
        }
        return true;
    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair {
    int x;
    long y;

    Pair(int x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        Pair pair = (Pair) o;
        return this.x < pair.x && this.y==pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}