import bisect H,N = map(int,input().split()) H_list = [int(input()) for _ in range(N-1)] H_list.sort() n = N - bisect.bisect(H_list,H) ans = "" if n%10 == 1: ans = str(n)+"st" elif n%10 == 2: ans = str(n)+"nd" elif n%10 == 3: ans = str(n)+"rd" else: ans = str(n)+"th" print(ans)