import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  }
} Main public static void main(String[] args) {
    resolve(System.in, System.out);
  } main {
    resolve(System.in, System.out);
  } resolve(System.in, System.out) resolve System.in System System.in System.out System System.out String[] args args static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  } resolve {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  } Scanner sc = new Scanner(is); sc new Scanner(is) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int k = Integer.parseInt(sc.next()); k Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int h[] = new int[n]; h new int[n] n for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      h[i] = Integer.parseInt(sc.next());
    } {
      h[i] = Integer.parseInt(sc.next());
    } h[i] = Integer.parseInt(sc.next()) h[i] h i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(h) Arrays.sort Arrays h long ans = 0; ans 0 for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    } int i = n - k - 1; int i = n - k - 1; i n - k - 1 n - k - 1 n k 1 i >= 0 i 0 i-- i-- i {
      ans += h[i];
    } {
      ans += h[i];
    } ans += h[i] ans h[i] h i pw.println(ans) pw.println pw ans InputStream is is PrintStream pw pw public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  }
} public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int h[] = new int[n];
    for (int i = 0; i < n; i++) {
      h[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(h);
    long ans = 0;
    for (int i = n - k - 1; i >= 0; i--) {
      ans += h[i];
    }
    pw.println(ans);
  }
}
