
fun main(arr:Array<String>) {
    val (a,b) = readLine()!!.split(" ").map { it.toInt() }
    val listAll = readLine()!!.split(" ").map { it.toLong() }
    val listMinus = listAll.filter { it < 0 }.sortedDescending()
    val listPlus = listAll.filter { it > 0}.sorted()
    val hasZero = listAll.contains(0L)
    val ans = Math.min(getAns(listPlus, listMinus, hasZero, b), getAns(listMinus, listPlus, hasZero, b))
    println(ans)
}

fun getAns(list1:List<Long>, list2:List<Long>, hasZero:Boolean, fire:Int):Long {
    if(list1.size == 0) {
        if(list2.size == 0) {
            return 0
        }
        return Math.abs(list2.last() * 2)
    }
    var ans = Math.abs(list1.last())*2
    if(list2.size > 0) {
        ans += Math.abs(list2.last()) * 2
    }

    for(i in list1.indices) {
        val remain = Math.max(0, fire - (i + 1) - (if (hasZero) 1 else 0))
        var tmp = Math.abs(list1[i])
        if (remain > 0) {
            if(remain > list2.size) {
                continue
            }
            tmp += Math.abs(list1[i])
            tmp += Math.abs(list2[remain-1])
        }
        ans = Math.min(tmp, ans)
    }
    return ans
}
