import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] n = new int[N]; Arrays.setAll(n, i -> sc.nextInt()); int min = Arrays.stream(n).min().getAsInt(); int max = Arrays.stream(n).max().getAsInt(); System.out.println(max - min); sc.close(); } }