import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  }
} import java.util.*; util.* java import java.util.Collections; Collections java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  } 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 long total = 0; total 0 ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      list.add(sc.nextInt());
    } {
      list.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list) Collections.sort Collections list for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    } int i = 0; int i = 0; i 0 i < N - K i N - K N K i++ i++ i {
      total += list.get(i);
    } {
      total += list.get(i);
    } total += list.get(i) total list.get(i) list.get list i System.out.println(total) System.out.println System.out System System.out total 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();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  }
} Main
import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long total = 0;
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < N; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    for (int i = 0; i < N - K; i++) {
      total += list.get(i);
    }
    System.out.println(total);
  }
}
