

#とりあえず全検索

iN,iK = [int(_) for _ in input().split()]

aX = [int(_) for _ in input().split()]

aP = [_ for _ in aX if  _ >= 0]

aM = [-1*_ for _ in aX if  _ < 0][::-1]

iP = len(aP)

iM = len(aM)

if iP == 0:

    print((aM[iK-1]))

    exit()

elif iM == 0:

    print((aP[iK-1]))

    exit()

iD = 2*aP[-1]+2*aM[-1]

for i in range(min(iP-1,iK-1),-1,-1):

    if iK - 2 -i < 0:

        iD = min(iD,aP[i])

    elif iM > iK -2 - i :

        iD = min(iD,aP[i] + 2*aM[iK-i-2])

for i in range(min(iM-1,iK-1),-1,-1):

    if iK - 2 - i < 0:

        iD = min(iD,aM[i])

    elif iP > iK -2 - i :

        iD =  min(iD,aM[i] + 2*aP[iK-i-2])

print(iD)

iN,iK = [int(_) for _ in input().split()]

aX = [int(_) for _ in input().split()]

ans = 10**9

iDiff = iN-iK

for i in range(iDiff + 1):

    iL = aX[i]

    iR = aX[iN-iDiff+i-1]

    ans = min(ans ,abs(iL) + abs(iL-iR),abs(iR) + abs(iR-iL))

print(ans)

# とりあえず全検索
iN, iK = [int(_) for _ in input().split()]
aX = [int(_) for _ in input().split()]
aP = [_ for _ in aX if _ >= 0]
aM = [-1 * _ for _ in aX if _ < 0][::-1]
iP = len(aP)
iM = len(aM)
if iP == 0:
    print((aM[iK - 1]))
    exit()
elif iM == 0:
    print((aP[iK - 1]))
    exit()
iD = 2 * aP[-1] + 2 * aM[-1]
for i in range(min(iP - 1, iK - 1), -1, -1):
    if iK - 2 - i < 0:
        iD = min(iD, aP[i])
    elif iM > iK - 2 - i:
        iD = min(iD, aP[i] + 2 * aM[iK - i - 2])
for i in range(min(iM - 1, iK - 1), -1, -1):
    if iK - 2 - i < 0:
        iD = min(iD, aM[i])
    elif iP > iK - 2 - i:
        iD = min(iD, aM[i] + 2 * aP[iK - i - 2])
print(iD)

iN, iK = [int(_) for _ in input().split()]
aX = [int(_) for _ in input().split()]
ans = 10**9
iDiff = iN - iK
for i in range(iDiff + 1):
    iL = aX[i]
    iR = aX[iN - iDiff + i - 1]
    ans = min(ans, abs(iL) + abs(iL - iR), abs(iR) + abs(iR - iL))
print(ans)

-# とりあえず全検索 -aP = [_ for _ in aX if _ >= 0] -aM = [-1 * _ for _ in aX if _ < 0][::-1] -iP = len(aP) -iM = len(aM) -if iP == 0: -    print((aM[iK - 1])) -    exit() -elif iM == 0: -    print((aP[iK - 1])) -    exit() -iD = 2 * aP[-1] + 2 * aM[-1] -for i in range(min(iP - 1, iK - 1), -1, -1): -    if iK - 2 - i < 0: -        iD = min(iD, aP[i]) -    elif iM > iK - 2 - i: -        iD = min(iD, aP[i] + 2 * aM[iK - i - 2]) -for i in range(min(iM - 1, iK - 1), -1, -1): -    if iK - 2 - i < 0: -        iD = min(iD, aM[i]) -    elif iP > iK - 2 - i: -        iD = min(iD, aM[i] + 2 * aP[iK - i - 2]) -print(iD) +ans = 10**9 +iDiff = iN - iK +for i in range(iDiff + 1): +    iL = aX[i] +    iR = aX[iN - iDiff + i - 1] +    ans = min(ans, abs(iL) + abs(iL - iR), abs(iR) + abs(iR - iL)) +print(ans)