N, M = map(int, input().split()) D = [int(input()) for _ in range(M)] L = [float('inf')]*M R = [float('inf')]*M for i in range(M): if D[i] < 0: L[i] = abs(D[i]) else: R[i] = abs(D[i]) L.append(0) R.append(0) L.sort() R.sort() dp = float('inf') for i in range(N+1): j = N-i dp = min(dp, L[i]*2+R[j], L[i]+R[j]*2) print(dp)