# vim: set fileencoding=utf-8:

import bisect





def main():

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

    x = [int(ele) for ele in input().split()]

    o = bisect.bisect_right(x, 0)

    top = min(o + K, N)

    bottom = max(o - K, 0)

    best = 999999999999

    for i in range(K):

        if top < bottom + i + K:

            break



        if x[bottom + i + K - 1] < 0:

            best = min(best, abs(x[bottom + i]))

        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:

            ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1])

            ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1])

            ans = min(best, ans1 + ans2)

            best = min(best, ans)

        elif 0 <= x[bottom + i]:

            best = min(best, x[bottom + i + K - 1])



    print(best)





if __name__ == "__main__":

    main()

# vim: set fileencoding=utf-8:

import bisect





def main():

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

    x = [int(ele) for ele in input().split()]

    o = bisect.bisect_right(x, 0)

    top = min(o + K, N)

    bottom = max(o - K, 0)

    best = 999999999999

    for i in range(K):

        if top < bottom + i + K:

            break



        l = x[bottom + i]

        r = x[bottom + i + K - 1]

        if l < 0 <= r:

            best = min(best, 2 * min(abs(l), r) + max(abs(l), r))

        elif l < 0 and r < 0:

            best = min(best, abs(l))

        elif 0 <= l and 0 <= r:

            best = min(best, abs(r))



    print(best)





if __name__ == "__main__":

    main()

# vim: set fileencoding=utf-8:
import bisect


def main():
    N, K = list(map(int, input().split()))
    x = [int(ele) for ele in input().split()]
    o = bisect.bisect_right(x, 0)
    top = min(o + K, N)
    bottom = max(o - K, 0)
    best = 999999999999
    for i in range(K):
        if top < bottom + i + K:
            break
        if x[bottom + i + K - 1] < 0:
            best = min(best, abs(x[bottom + i]))
        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:
            ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans = min(best, ans1 + ans2)
            best = min(best, ans)
        elif 0 <= x[bottom + i]:
            best = min(best, x[bottom + i + K - 1])
    print(best)


if __name__ == "__main__":
    main()

# vim: set fileencoding=utf-8:
import bisect


def main():
    N, K = list(map(int, input().split()))
    x = [int(ele) for ele in input().split()]
    o = bisect.bisect_right(x, 0)
    top = min(o + K, N)
    bottom = max(o - K, 0)
    best = 999999999999
    for i in range(K):
        if top < bottom + i + K:
            break
        l = x[bottom + i]
        r = x[bottom + i + K - 1]
        if l < 0 <= r:
            best = min(best, 2 * min(abs(l), r) + max(abs(l), r))
        elif l < 0 and r < 0:
            best = min(best, abs(l))
        elif 0 <= l and 0 <= r:
            best = min(best, abs(r))
    print(best)


if __name__ == "__main__":
    main()

-        if x[bottom + i + K - 1] < 0: -            best = min(best, abs(x[bottom + i])) -        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]: -            ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1]) -            ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1]) -            ans = min(best, ans1 + ans2) -            best = min(best, ans) -        elif 0 <= x[bottom + i]: -            best = min(best, x[bottom + i + K - 1]) +        l = x[bottom + i] +        r = x[bottom + i + K - 1] +        if l < 0 <= r: +            best = min(best, 2 * min(abs(l), r) + max(abs(l), r)) +        elif l < 0 and r < 0: +            best = min(best, abs(l)) +        elif 0 <= l and 0 <= r: +            best = min(best, abs(r))