class Problem0564: def solve(this): h,n = map(int, input().split()) res = [int(input()) for i in range(n - 1)] res.append(h) res.sort() r = n - res.index(h) if r % 10 == 1: print(str(r) + 'st') elif r % 10 == 2: print(str(r) + 'nd') elif r % 10 == 3: print(str(r) + 'rd') else: print(str(r) + 'th') if __name__ == "__main__": problem = Problem0564() problem.solve()