object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val monstersCount = sc.nextInt()
    val attackCount = sc.nextInt()
    val monsters = Array.fill(monstersCount)(sc.nextInt())

    val attackingMonsters: Array[BigInt] =
      monsters.sorted.reverse.drop(attackCount).map(BigInt(_))

    val ans = attackingMonsters.sum

    println(ans)
  }
}
