H,N=map(int,input().split()) Hi = [int(input()) for i in range(N-1)] Hi.append(H) Hi.sort(reverse=True) tmp=[] for i in enumerate(Hi): if i[1]==H: num=i[0]+1 break if str(num)[-1]=='1': print(str(num)+'st') elif str(num)[-1]=='2': print(str(num)+'nd') elif str(num)[-1]=='3': print(str(num)+'rd') else: print(str(num)+'th')