
val Int.absoluteValue: Int
    get() = if (this >= 0) this else -this
fun minOf(a:Int, b:Int): Int {
    return if (a > b) b else a
}
fun maxOf(a: Int, b:Int): Int {
    return if (a > b) a else b
}
fun main(args:Array<String>): Unit {
    val (n, k) = readLine()!!.trim().split(' ').map(String::toInt)
    val x = readLine()!!.trim().split(' ').map(String::toInt).toIntArray()
    val leftDist = IntArray(n){if (x[it] < 0) -x[it] else 0}
    val rightDist = IntArray(n){if (x[it] > 0) x[it] else 0}
    var min = Int.MAX_VALUE
    for (i in 0 .. n - k){
        min = minOf(min, minOf(leftDist[i], rightDist[i + k - 1]) * 2 + maxOf(leftDist[i], rightDist[i + k - 1]))
    }
    println(min)
}