using System; namespace No021 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int k = int.Parse(Console.ReadLine()); int[] num = new int[n]; double max = 0.0, min = 1000.0; for (int i = 0; i < n; i++) num[i] = int.Parse(Console.ReadLine()); for (int i = 0; i < n - 1; i++) for (int j = i + 1; j < n; j++) Search(num, i, j, ref max, ref min); Console.WriteLine((int)Math.Ceiling(max - min)); } static void Search(int[] num, int a, int b, ref double max, ref double min) { int sum = 0, count = 0; double ave; for (int i = 0; i < num.Length; i++) { if (i == a || i == b) continue; sum += num[i]; count++; ave = (double)sum / (double)count; if (max < ave) max = ave; if (min > ave) min = ave; } } } }