# Generated by AtcoderGreedy on 2018-05-26
# ARC098 E
# Your code here

N, K, Q = gets.chomp.split(' ').map(&:to_i)
A = gets.chomp.split(' ').map(&:to_i)

sorted = A.sort

diffs = (0..(N+1-Q-K)).map do |i|
  sorted[i+Q-1] - sorted[i]
end

puts diffs.min
