fun main() {
    val firstLine = readLine()!!
    val prices = readLine()!!.split("\\s+".toRegex()).map { it.toInt() }.toIntArray()
    val k = firstLine[2] - '0'
    println(prices.apply { sort() }.take(k).sum())
}