import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int M = scan.nextInt(); int []D = new int[M]; for(int i = 0; i < M; i++) { D[i] = scan.nextInt(); } scan.close(); Arrays.sort(D); int min = Integer.MAX_VALUE; for(int i = 0; i <= M - N; i++) { int l = D[i]; int r = D[i + N - 1]; if(r < 0 && l < 0) { min = Math.min(min, -l); }else if(l <= 0 && r >= 0) { int t = Math.min(2 * r - l, -2 * l + r); min = Math.min(min, t); }else { min = Math.min(min, r); } } System.out.println(min); } }