import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc List<Long> list = new ArrayList<>(); list new ArrayList<>() long ans = 0; ans 0 for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        } {
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        } long num = sc.nextLong(); num sc.nextLong() sc.nextLong sc list.add(num) list.add list num ans += num ans num Collections.sort(list) Collections.sort Collections list Collections.reverse(list) Collections.reverse Collections list if(k > n){
            k = n;
        } k > n k n {
            k = n;
        } k = n k n for(int i = 0;i<k;i++){
            ans -= list.get(i);
        } int i = 0; int i = 0; i 0 i<k i k i++ i++ i {
            ans -= list.get(i);
        } {
            ans -= list.get(i);
        } ans -= list.get(i) ans list.get(i) list.get list i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Long> list = new ArrayList<>();
        long ans = 0;
        for(int i = 0;i<n;i++){
            long num = sc.nextLong();
            list.add(num);
            ans += num;
        }
        Collections.sort(list);
        Collections.reverse(list);
        if(k > n){
            k = n;
        }
        for(int i = 0;i<k;i++){
            ans -= list.get(i);
        }
        System.out.println(ans);
    }
}