H,N=map(int,input().split()) L_H=[] for i in range(N-1): L_H.append(int(input())) L_H.sort(reverse=True) postfix=["st","nd","rd"] for i in range(len(L_H)): if L_H[i] < H: try: p=postfix[i] except IndexError: p="th" print(str(i+1)+p) exit() print(str(i+2)+"th")