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