import scala.io.StdIn._
import java.lang.Math._
object Main {
  def main(args: Array[String]): Unit = {
    val NK = readLine.split("\\s+").toSeq.map{_.toInt}
    val N = NK(0)
    val K = NK(1)
    val x = readLine.split("\\s+").toSeq.map{_.toInt}
    val xs = for(i <- 0 to N - 1) yield x(i)
    val lb = scala.collection.mutable.ListBuffer[Int]()
    for(st <- 0 to N - K){
      if(xs(st) >= 0) lb += xs(st + K - 1)
      else if(xs(st + K - 1) > 0){
        lb += abs(xs(st))*2 + xs(st + K - 1)
        lb += xs(st + K - 1)*2 + abs(xs(st))
      }else lb += abs(xs(st))
    }
    println(lb.min.toString)
  }
}
