import kotlin.math.abs
import kotlin.math.min

fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val (n, k) = intList()
    val x = longList()
    val b = (x.indexOfFirst { it >= 0 } + 1).takeIf { it > 0 } ?: n - 1
    var m = Long.MAX_VALUE
    ((b - k).takeIf { it > 0 } ?: 0).until(b + 1).forEach {
        if (it >= 0 && it + k <= n) {
            val l = x[it]
            val r = x[it + k - 1]
            m = if (l < 0) {
                if (r < 0) {
                    min(m, abs(l))
                } else {
                    min(m, min(abs(l) * 2 + r, abs(l) + r * 2))
                }
            } else {
                min(m, abs(r))
            }
        }
    }
    if (m == Long.MAX_VALUE) {
        println("0")
    } else {
        println(m.toString())
    }
}
