import Data.List
import Data.List.Split
solve q k a x
  | length ys < q = 10^9
  | otherwise = sort ys !! (q-1) - x
  where
    ys = concatMap (drop (k-1) . reverse . sort) $ wordsBy (x >) a
main = do
  [n,k,q] <- map read . words <$> getLine
  a <- map read . words <$> getLine
  print $ minimum $ map (solve q k a) a