using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var line = Console.ReadLine().Split(' '); var height = int.Parse(line[0]); var N = int.Parse(line[1]); var list = new List(N) { height }; for (int i = 0; i < N-1; i++) list.Add(int.Parse(Console.ReadLine())); list = list.OrderByDescending(x => x).Distinct().ToList(); string idxStr = (list.IndexOf(height) + 1).ToString(); char od = (idxStr.Length >= 2) ? idxStr[1]: idxStr[0]; switch (od) { case '1': Console.WriteLine("{0}st", idxStr); break; case '2': Console.WriteLine("{0}nd", idxStr); break; case '3': Console.WriteLine("{0}rd", idxStr); break; default: Console.WriteLine("{0}th", idxStr); break; } } }