f1,num=map(int,input().split()) fL=[f1] for x in range(num-1): fL.append(int(input())) B={a:i+1 for (i,a) in enumerate(sorted(fL,reverse=True))} r=str(B[f1]) if r[-1:]=='1': print(r+"st") elif r[-1:]=='2': print(r+"nd") elif r[-1:]=='3': print(r+"rd") else: print(r+"th")