using System; public class Hello{ public static void Main(){ string[] input = Console.ReadLine().Split(' '); int nama = int.Parse(input[0]); int N = int.Parse(input[1]); int[] height = new int[N]; for(int x = 0;x < N - 1;x++){ int input2 = int.Parse(Console.ReadLine()); height[x] = input2; } height[N - 1] = nama; for(int y = 0;y < N - 1;y++){ for(int z = y + 1;z < N;z++){ if(height[y] < height[z]){ int temp; temp = height[y]; height[y] = height[z]; height[z] = temp; } } } for(int i = 0;i < N;i++){ if(nama == height[i]){ if((i + 1) % 10 == 1){ Console.WriteLine((i + 1) + "st"); }else if((i + 1) % 10 == 2){ Console.WriteLine((i + 1) + "nd"); }else if((i + 1) % 10 == 3){ Console.WriteLine((i + 1) + "rd"); }else{ Console.WriteLine((i + 1) + "th"); } } Console.WriteLine(height[i]); } } }