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 rank | num == 1 = "st" | num == 2 = "nd" | num == 3 = "rd" | otherwise = "th"