N,K=list(map(int,input().split()))

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



def culclen(l,r):

  if X[l]*X[r]>=0:

    return max(abs(X[l]),abs(X[r]))

  else:

    ldis=abs(X[l])

    rdis=abs(X[r])

    return min(ldis,rdis)*2+max(ldis,rdis)



ans=10**9

for x in range(len(X)-K+1):

  ans=min(ans,culclen(x,x+K-1))

print(ans)

N,K=list(map(int,input().split()))

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



def culclen(l,r):

  return abs(X[r]-X[l])+min(abs(X[l]),abs(X[r]))



ans=10**9

for x in range(len(X)-K+1):

  ans=min(ans,culclen(x,x+K-1))

print(ans)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))


def culclen(l, r):
    if X[l] * X[r] >= 0:
        return max(abs(X[l]), abs(X[r]))
    else:
        ldis = abs(X[l])
        rdis = abs(X[r])
        return min(ldis, rdis) * 2 + max(ldis, rdis)


ans = 10**9
for x in range(len(X) - K + 1):
    ans = min(ans, culclen(x, x + K - 1))
print(ans)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))


def culclen(l, r):
    return abs(X[r] - X[l]) + min(abs(X[l]), abs(X[r]))


ans = 10**9
for x in range(len(X) - K + 1):
    ans = min(ans, culclen(x, x + K - 1))
print(ans)

-    if X[l] * X[r] >= 0: -        return max(abs(X[l]), abs(X[r])) -    else: -        ldis = abs(X[l]) -        rdis = abs(X[r]) -        return min(ldis, rdis) * 2 + max(ldis, rdis) +    return abs(X[r] - X[l]) + min(abs(X[l]), abs(X[r]))