h,n = map(int,input().split()) array = [h] + [int(input()) for i in range(n-1)] array_s = list(sorted(array))[::-1] result = array_s.index(h)+1 if result==1: print("{}st".format(result)) elif result==2: print("{}nd".format(result)) elif result==3: print("{}rd".format(result)) else: print("{}th".format(result))