import java.util.Scanner; class Main { public static void main(String[] args) { No0021 no = new No0021(); System.out.println(no.result()); } } class No0021 { private int n; private int k; private String result; public No0021() { Scanner sc = new Scanner(System.in); this.n = sc.nextInt(); this.k = sc.nextInt(); int min = sc.nextInt(); int max = min; for (int i = 1; i < this.n; i++) { int val = sc.nextInt(); if (val < min) { min = val; } else if (max < val) { max = val; } } int sub = max - min; this.result = String.valueOf(sub); } public String result() { return this.result; } }