using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using static System.Console; namespace yukicoder { class Program { static void Main() { int N = int.Parse(Console.ReadLine()); int K = int.Parse(Console.ReadLine()); int[] nums = new int[K]; for (int i = 0; i < K; i++) { nums[i] = int.Parse(Console.ReadLine()); } int Min = nums.Min(); int Max = nums.Max(); Console.WriteLine(Max - Min); } } }