h,n=map(int,input().split());c=0 H=sorted([int(input())for _ in range(n-1)])[::-1] for i in range(n-1): if H[i]>h: c+=1 else: break if str(c+1)[-1]=='1': print(str(c+1)+'st') elif str(c+1)[-1]=='2': print(str(c+1)+'nd') elif str(c+1)[-1]=='3': print(str(c+1)+'rd') else: print(str(c+1)+'th')