H,N,*h=map(int,open(0).read().split()) h.append(H) h.sort(reverse=True) ans=h.index(H)+1 if ans%10==1: print(f"{ans}st") elif ans%10==2: print(f"{ans}nd") elif ans%10==3: print(f"{ans}rd") else: print(f"{ans}th")