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