function Main(input) {
    input = input.split("\n");
  	var distance=input[0].split(" ");
  	var count=parseInt(distance[1],10);
  	var minute=input[1].split(" ");
  	var array=[];
    for(var i=0;i<count-1;i++){
      var num=Math.abs(parseInt(minute[i],10)-parseInt(minute[i+1],10));
      array.push(num);
    }
  	console.log(Math.min.apply(null,array));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));