object Main extends App {
  val lines = io.Source.stdin.getLines().toList

  val params = for (line <- lines) yield {
    line.split(" ").map(_.toLong)
  }

  println(params(1).sorted.take((params(0)(0) - params(0)(1)).toInt).sum)
}
