from pprint import pprint import bisect def main(): h,n=map(int,input().split()) l=[] for i in range(n-1): l.append(int(input())) l.sort() ans=len(l)-bisect.bisect_left(l,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") if __name__ == "__main__": main()