import Data.List (sort) import Control.Monad (replicateM) main = do [h, n] <- map read . words <$> getLine hs <- reverse . sort <$> replicateM (n - 1) readLn putStrLn $ solve h hs solve h hs = show num ++ rank where num = succ $ length $ filter (>h) hs n = num - div num 10 * 10 rank | n == 1 = "st" | n == 2 = "nd" | n == 3 = "rd" | otherwise = "th"