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