import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  }

  static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.Comparator; Comparator java.util import java.util.ArrayList; ArrayList java.util public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  }

  static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  }
} Main public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  } main {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) CFennecVsMonster solver = new CFennecVsMonster(); solver new CFennecVsMonster() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  } CFennecVsMonster public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    } solve {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    } int n = in.nextInt(); n in.nextInt() in.nextInt in int k = in.nextInt(); k in.nextInt() in.nextInt in List<Integer> al = new ArrayList<>(); al new ArrayList<>() long ans = 0; ans 0 for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        al.add(in.nextInt());
      } {
        al.add(in.nextInt());
      } al.add(in.nextInt()) al.add al in.nextInt() in.nextInt in al.sort(Comparator.reverseOrder()) al.sort al Comparator.reverseOrder() Comparator.reverseOrder Comparator if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      } k >= n k n {
        out.println(0);
      } out.println(0) out.println out 0 {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      } for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          if (i >= k) {
            ans += al.get(i);
          }
        } {
          if (i >= k) {
            ans += al.get(i);
          }
        } if (i >= k) {
            ans += al.get(i);
          } i >= k i k {
            ans += al.get(i);
          } ans += al.get(i) ans al.get(i) al.get al i out.println(ans) out.println out ans int testNumber testNumber Scanner in in PrintWriter out out public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  }

  static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  }
} public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  }

  static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CFennecVsMonster solver = new CFennecVsMonster();
    solver.solve(1, in, out);
    out.close();
  }

  static class CFennecVsMonster {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      List<Integer> al = new ArrayList<>();
      long ans = 0;
      for (int i = 0; i < n; i++) {
        al.add(in.nextInt());
      }
      al.sort(Comparator.reverseOrder());

      if (k >= n) {
        out.println(0);
      } else {
        for (int i = 0; i < n; i++) {
          if (i >= k) {
            ans += al.get(i);
          }
        }
        out.println(ans);
      }

    }

  }
}

