import java.util.Arrays; import java.util.Scanner; public class No21 { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int N = sc.nextInt(); sc.nextInt(); int[] n = new int[N]; for (int i = 0; i < N; i++)n[i] = sc.nextInt(); Arrays.sort(n); System.out.println(n[n.length - 1] - n[0]); } }