H,N=map(int,input().split()) list=[int(input())for x in range (N-1)] list.append(H) Nlist=sorted(list,reverse=True) a=Nlist.index(H)+1 if a%10==1: print(str(a)+'st') elif a%10==2: print(str(a)+'nd') elif a%10==3: print(str(a)+'rd') else: print(str(a)+'th')