import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    var K = sc.nextInt
    val x = Array.fill(N)(sc.nextInt)

    if (x.contains(0)) K -= 1
    val xr = 0 +: x.filter(_ < 0).map(-_).sorted.take(K)
    val xf = 0 +: x.filter(_ > 0).sorted.take(K)

    val a =
      (for (i <- xr.indices if K - i < xf.length) yield xr(i) * 2 + xf(K - i)) ++:
      (for (i <- xf.indices if K - i < xr.length) yield xf(i) * 2 + xr(K - i))

    a.min.toString
  }
}
