import bisect def main(): H, N = map(int, input().split()) Hn = tuple(int(input()) for _ in range(N - 1)) hn = sorted(Hn) rank = N - bisect.bisect_left(hn, H) ans = { 1 : '1st', 2 : '2nd', 3 : '3rd' }.get(rank, str(rank) + 'th') print(ans) main()