import java.util.Scanner; public class Yuki370 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N, M; N = sc.nextInt(); M = sc.nextInt(); int[] D = new int[M]; for (int i = 0; i < M; i++) { D[i] = sc.nextInt(); } int ans = (int) 1e9; for (int i = 0; i + N - 1 < D.length; i++) { if (0 <= D[i]) { ans = Math.min(ans, Math.abs(D[i + N - 1])); } else if (D[i] < 0 && 0 < D[i + N - 1]) { int buf = Math.abs(D[i]) * 2 + Math.abs(D[i + N - 1]); buf = Math.min(buf, Math.abs(D[i]) + Math.abs(D[i + N - 1]) * 2); ans = Math.min(ans, buf); } else { ans = Math.min(ans, Math.abs(D[i])); } } System.out.println(ans); } }