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]; for(int i = 0; i < n - 1; i++) { hh[i] = sc.nextInt(); } hh[n - 1] = h; Arrays.sort(hh, Collections.reverseOrder()); for(int i = 0; i < n; i++) { if(h == hh[i]) { if(i == 0) { System.out.println("1st"); }else if(i == 1) { System.out.println("2nd"); }else if(i == 2) { System.out.println("3rd"); }else { System.out.println(i + 1 + "th"); } return; } } } }