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