# ABC107C - Candles (ARC101C)

def main():

    N, K, *X = list(map(int, open(0).read().split()))

    ans = float("inf")

    for l, r in zip(X, X[K - 1 :]):

        ans = min(ans, r - l + min(abs(l), abs(r)))

    print(ans)





if __name__ == "__main__":

    main()
# ABC107C - Candles (ARC101C)

def main():

    N, K, *X = list(map(int, open(0).read().split()))

    ans = float("inf")

    for l, r in zip(X, X[K - 1 :]):

        x = r - l + min(abs(l), abs(r))

        ans = x if x < ans else ans

    print(ans)





if __name__ == "__main__":

    main()
# ABC107C - Candles (ARC101C)
def main():
    N, K, *X = list(map(int, open(0).read().split()))
    ans = float("inf")
    for l, r in zip(X, X[K - 1 :]):
        ans = min(ans, r - l + min(abs(l), abs(r)))
    print(ans)


if __name__ == "__main__":
    main()

# ABC107C - Candles (ARC101C)
def main():
    N, K, *X = list(map(int, open(0).read().split()))
    ans = float("inf")
    for l, r in zip(X, X[K - 1 :]):
        x = r - l + min(abs(l), abs(r))
        ans = x if x < ans else ans
    print(ans)


if __name__ == "__main__":
    main()

-        ans = min(ans, r - l + min(abs(l), abs(r))) +        x = r - l + min(abs(l), abs(r)) +        ans = x if x < ans else ans