import java.util.*; public class AverageDifference { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int K = scanner.nextInt(); int[] num = new int[N]; for(int i = 0 ; i < N ; i++){ num[i] = scanner.nextInt(); } Arrays.sort(num); System.out.print(num[N-1] - num[0]); } }