import java.util.*

fun main(args: Array<String>) {
    val cin = Scanner(System.`in`)
    val N = cin.nextInt()
    val K = cin.nextInt()
    val L = emptyList<Int>().toMutableList()
    (0 until N).forEach {
        L.add(cin.nextInt())
    }
    val M = L.sorted().reversed()
    var out = 0
    (0 until K).forEach {
        out += M[it]
    }
    println(out)
}