h, n = map(int, input().split(" ")) # l = [int(input()) for i in range(n)] l = [h] for i in range(n-1): a = int(input()) l.append(a) l.sort(reverse=True) ans = n for i in range(n): if l[i] == h: ans = i+1 ans = str(ans) if ans == "1": ans += "st" elif ans == "2": ans += "nd" elif ans == "3": ans += "rd" else: ans += "th" print(ans)