H, N = map(int, raw_input().split()) height = [H] for i in range(1, N): height.append(int(raw_input())) height.sort() height.reverse() nama = 0 for i in range(0, N): if height[i] == H: nama = i+1 break ans = str(nama) if ans[-1] == '1': ans = ans + 'st' elif ans[-1] == '2': ans = ans + 'nd' elif ans[-1] == '3': ans = ans + 'rd' else: ans = ans + 'th' print ans