import java.util.Scanner; import java.util.stream.IntStream; public class Main{ static IntStream REPS(int v){return IntStream.range(0,v);} static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);} static IntStream INS(int n) {return REPS(n).map(i->getInt());} static Scanner s=new Scanner(System.in); static int getInt(){return Integer.parseInt(s.next());} public static void main(String[]$){ int h=getInt(),n=getInt(); int j=1; for(int l=n-1;l>0;--l) if(getInt()>h) ++j; String r=""+j; switch(j%10) { case 1: r+="st"; break; case 2: r+="nd"; break; case 3: r+="rd"; break; default: r+="th"; break; } System.out.println(r); } }