m = gets.to_i k = gets.to_i n = Array.new m.times do |x| n.push(gets.to_i) end mm = n.minmax puts mm[1] - mm[0]