import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

import scala.annotation.tailrec

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val Array(n, k) = input.nextLine().split(" ").map(_.toInt)
      val xs = input.nextLine().split(" ").map(_.toInt)

      val lefts = xs.filter(_ <= 0).map(_ * -1).reverse
      val rights = xs.filter(_ >= 0)
      val costs = Seq(
        solve(lefts, rights, k),
        if (lefts.length >= k) lefts(k-1) else Int.MaxValue,
        if (rights.length >= k) rights(k-1) else Int.MaxValue
      )
      output.println(costs.min)
    }

    def solve(lefts: Array[Int], rights: Array[Int], k: Int): Int = {
      var leftPos, rightPos = 0
      var leftIdx, rightIdx = 0
      var foundCount = 0

      if (rights.headOption.contains(0)) {
        leftIdx += 1
        rightIdx += 1
        foundCount += 1
      }

      if (foundCount >= k) {
        return 0
      }

      1.to(Math.pow(10, 8).toInt).foreach { i =>
        if (rights.applyOrElse(rightIdx, (_: Int) => -1) == i) {
          rightPos = i
          rightIdx += 1
          foundCount += 1
        }

        if (foundCount >= k) {
          val min = leftPos.min(rightPos)
          val max = leftPos.max(rightPos)
          return min * 2 + max
        }

        if (lefts.applyOrElse(leftIdx, (_: Int) => -1) == i) {
          leftPos = i
          leftIdx += 1
          foundCount += 1
        }

        if (foundCount >= k) {
          val min = leftPos.min(rightPos)
          val max = leftPos.max(rightPos)
          return min * 2 + max
        }
      }

      0
    }

    @tailrec
    final def gcd(m: Int, n: Int): Int = {
      val (x, y) = if (m > n) (m, n) else (n, m)
      if (y != 0) gcd(y, x % y)
      else x
    }

  }

}
