#!/usr/bin/env python3 n, m = map(int,input().split()) d = list(sorted(map(lambda _: int(input()), range(m)))) ans = float('inf') for l in range(m): try: r = l + n - 1 if d[l] < d[r] <= 0: acc = - d[l] elif 0 <= d[l] < d[r]: acc = d[r] else: acc = max(- d[l], d[r]) + 2 * min(- d[l], d[r]) ans = min(ans, acc) except Exception as e: pass print(ans)