import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] a) { Scanner s=new Scanner(System.in); int[] A=new int[s.nextInt()];s.nextInt(); int i=0; while(s.hasNext())A[i++]=s.nextInt(); Arrays.sort(A); System.out.println(A[i-1]-A[0]); } }