import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class No564 { public static void main(String[] args){ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] temp = br.readLine().split(" "); int H = Integer.parseInt(temp[0]); int N = Integer.parseInt(temp[1]); int[] heights = new int[N]; for(int i=1; i < N; i++) heights[i] = Integer.parseInt(br.readLine()); heights[0] = H; Arrays.sort(heights); int count = 0; for(int i=0; i < N; i++){ if(heights[i] == H){ count = i+1; break; } } int hitoketa = (N - count + 1) % 10; switch(hitoketa){ case 1: System.out.println((N - count + 1) + "st"); break; case 2: System.out.println((N - count + 1) + "nd"); break; case 3: System.out.println((N - count + 1) + "rd"); break; default: System.out.println((N - count + 1) + "th"); break; } }catch(Exception e){ e.getStackTrace(); } } }