import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader =new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(reader.readLine()); int K = Integer.parseInt(reader.readLine()); int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for (int i = 0; i < N; i++) { int n = Integer.parseInt(reader.readLine()); max = Math.max(max,n); min = Math.min(min,n); } int difference = (max - min); System.out.println(difference); } }