h, n = map(int, input().split()) a = [int(input()) for i in range(n-1)] a.append(h) a.sort(reverse=True) ret = a.index(h)+1 r = ret % 10 if r == 1: print("{}st".format(ret)) elif r == 2: print("{}nd".format(ret)) elif r == 3: print("{}rd".format(ret)) else: print("{}th".format(ret))