// C - Candles
// https://abc107.contest.atcoder.jp/tasks/arc101_a

import scala.io.StdIn.readLine

object Main extends App {

  val Array(n, k) = readLine.split(" ").map(_.toInt)
  val xs: Array[Int] = readLine.split(" ").map(_.toInt)

  val edges: List[(Int, Int)] = List.range(0, n-k).map(i => (xs(i), xs(i+k-1)))

  val lengths = edges.map(edge => {
    val abs1 = Math.abs(edge._1)
    val abs2 = Math.abs(edge._2)
    val max = Math.max(abs1, abs2)
    val min = Math.min(abs1, abs2)

    if (edge._1 * edge._2 >= 0) max
    else min * 2 + max
  })

  val length = if (lengths.length > 0) lengths.min else 0

  println(length)

}