H, N = [int(i) for i in input().split(' ')] height_list = [H] for _ in range(N - 1): height_list.append(int(input())) height_list.sort(reverse=True) rank = height_list.index(H) + 1 end = rank % 10 suffix = ['th', 'st', 'nd', 'rd', 'th'][end if end <= 3 else 4] print(f'{rank}{suffix}')