h, n = map(int,input().split()) lis = sorted([int(input()) for _ in range(n-1)] + [h], reverse=True) for i in range(n): if lis[i] == h: v = str(i+1)[-1] a = "st" if v == "1" else ("nd" if v == "2" else ("rd" if v == "3" else "th")) print(f"{i+1}{a}") break