h, n = map(int, input().split()) a = sorted([int(input()) for _ in range(n - 1)] + [h], reverse=True) res = a.index(h) + 1 if res % 10 == 1: print(str(res) + 'st') elif res % 10 == 2: print(str(res) + 'nd') elif res % 10 == 3: print(str(res) + 'rd') else: print(str(res) + 'th')