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 [] D = new int [M]; for(int i=0; i0 && D[i+N-1]>0 ){ d=D[i+N-1]; }else{ int a = 2*D[i+N-1]-D[i]; int b = D[i+N-1]-2*D[i]; d=Math.min(a,b); } min=Math.min(min,d); } System.out.println(min); } }