N = gets.to_i K = gets.to_i lst = [] N.times{ lst << gets.to_i } puts lst.max - lst.min