# coding: utf-8 from collections import defaultdict as dd from collections import Counter from collections import deque from string import ascii_lowercase def main(): N,M = map(int,raw_input().split()) Dp = [] Dn = [] for m in range(M): p = input() if p == 0: N = N-1 elif p > 0: Dp.append(p) else: Dn.append(-p) Dp.sort() Dn.sort() distances = [] for n in range(N+1): # n is negative number if N-n <= len(Dp): a = Dp[N-n-1] if N-n == N: distances.append(a) continue else: continue if n <= len(Dn): b = Dn[n-1] if n == N: distances.append(b) continue else: continue distances.append(2*a + b if a < b else a + 2*b) distances.sort() print(distances[0]) if __name__ == "__main__": main()