n = gets.to_i k = gets.to_i arr = n.times.map{gets.to_i}.sort puts arr[-1] - arr[0]