import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.StreamTokenizer

class A

fun main( args: Array<String> ) {
    val st = StreamTokenizer( BufferedReader( InputStreamReader( System.`in` ) ) )
    val n = st.nextInt()
    val k = st.nextInt()
    if ( k == 0 ) {
        println( 0 )
        return
    }
    val x = IntArray( n, { st.nextInt() } )
    x.sort()
    var best = Int.MAX_VALUE
    for ( i in 0 .. n - k ) {
        val left = x[i]
        val right = x[i + k - 1]
        val dist = if ( ( left < 0 ) == ( right < 0 ) ) {
            Math.max( Math.abs( left ), Math.abs( right ) )
        } else {
            val min = Math.min( Math.abs( left ), Math.abs( right ) )
            min + Math.abs( left ) + Math.abs( right )
        }
        best = Math.min( best, dist )
    }
    println( best )
}

private fun StreamTokenizer.nextInt(): Int {
    nextToken()
    return nval.toInt()
}
