import java.util.*; import java.util.stream.Stream; import java.time.*; import java.time.format.*; public class No564 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int n = sc.nextInt(); Integer[] hh = new Integer[n]; hh[0] = h; for(int i = 1; i < n; i++) { hh[i] = sc.nextInt(); } Arrays.sort(hh, Collections.reverseOrder()); for(int i = 0; i < n; i++) { if(h == hh[i]) { int j = i + 1; if(j%10 == 1) { System.out.println(j + "st"); }else if(j%10 == 2) { System.out.println(j + "nd"); }else if(j%10 == 3) { System.out.println(j + "rd"); }else { System.out.println(j + "th"); } return; } } } }