import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int K = sc.nextInt(); int[] arr = new int[N]; for(int i = 0; i < N; i++){ arr[i] = sc.nextInt(); } int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for(int i = 0; i < N; i++){ max = Math.max(max, arr[i]); min = Math.min(min, arr[i]); } System.out.println(max - min); } }