object Main {
  def main(args: Array[String]): Unit = {
    val factors           = io.StdIn.readLine.split(" ").map{_.toInt}
    val monsters_hp       = io.StdIn.readLine.split(" ").map{_.toInt}.sorted
    var all_attacks_count = 0.toLong

    (0 until monsters_hp.length - factors( 1 ) ).foreach{ i =>
      all_attacks_count += monsters_hp( i ).toLong
    }

    println( all_attacks_count )
  }
}