x,n=map(int,input().split()) h=[x]+[int(input()) for _ in range(n-1)] h.sort() a=n-h.index(x) if a%10==1: print('1st') elif a%10==2: print('2nd') elif a%10==3: print('3rd') else: print(str(a)+'th')