fun main(args: Array<String>){
val (K,N) = readLine()!!.split(" ").map{ it.toInt() }
val list = readLine()!!.split(" ").map{ it.toInt() }
val seiri = list.sorted()
  var ans = 0
  for(i in 1..N-1){
    ans = ans + list[N-1]
  }
println(ans)
}