import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] points = new int[m]; for (int i = 0; i < m; i++) { points[i] = sc.nextInt(); } Arrays.sort(points); int min = Integer.MAX_VALUE; for (int i = 0; i + n <= m; i++) { int end = i + n - 1; if (points[i] * points[end] < 0) { min = Math.min(min, points[end] - points[i] + Math.min(-points[i], points[end])); } else { if (points[i] < 0) { min = Math.min(min, -points[i]); } else { min = Math.min(min, points[end]); } } } System.out.println(min); } }