n, k = list(map(int, input().split()))

x = list(map(int, input().split()))

p = n

for i in range(n):

  if x[i] > 0:

    p = i

    break

result = float('inf')

for i in range(k + 1):

  if p - i < 0 or p + k - i > n:

    continue

  if i == 0:

    t = min(result, x[p + k - 1])

  elif i == k:

    t = min(result, abs(x[p - k]))

  else:

    t = min(result, abs(x[p - i]) * 2 + x[p + (k - i) - 1], abs(x[p - i]) + x[p + (k - i) - 1] * 2)

  result = min(result, t)

print(result)

n, k = list(map(int, input().split()))

x = list(map(int, input().split()))

p = n

for i in range(n):

  if x[i] > 0:

    p = i

    break

result = float('inf')

for i in range(k + 1):

  if p - i < 0 or p + k - i > n:

    continue

  if i == 0:

    result = min(result, x[p + k - 1])

  elif i == k:

    result = min(result, -x[p - k])

  else:

    l = x[p - i]

    r = x[p + (k - i) - 1]

    result = min(result, r - 2 * l, r * 2 - l)

print(result)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
p = n
for i in range(n):
    if x[i] > 0:
        p = i
        break
result = float("inf")
for i in range(k + 1):
    if p - i < 0 or p + k - i > n:
        continue
    if i == 0:
        t = min(result, x[p + k - 1])
    elif i == k:
        t = min(result, abs(x[p - k]))
    else:
        t = min(
            result,
            abs(x[p - i]) * 2 + x[p + (k - i) - 1],
            abs(x[p - i]) + x[p + (k - i) - 1] * 2,
        )
    result = min(result, t)
print(result)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
p = n
for i in range(n):
    if x[i] > 0:
        p = i
        break
result = float("inf")
for i in range(k + 1):
    if p - i < 0 or p + k - i > n:
        continue
    if i == 0:
        result = min(result, x[p + k - 1])
    elif i == k:
        result = min(result, -x[p - k])
    else:
        l = x[p - i]
        r = x[p + (k - i) - 1]
        result = min(result, r - 2 * l, r * 2 - l)
print(result)

-        t = min(result, x[p + k - 1]) +        result = min(result, x[p + k - 1]) -        t = min(result, abs(x[p - k])) +        result = min(result, -x[p - k]) -        t = min( -            result, -            abs(x[p - i]) * 2 + x[p + (k - i) - 1], -            abs(x[p - i]) + x[p + (k - i) - 1] * 2, -        ) -    result = min(result, t) +        l = x[p - i] +        r = x[p + (k - i) - 1] +        result = min(result, r - 2 * l, r * 2 - l)