H, N = map(int, input().split()) heights = [] heights.append(H) for x in range(N-1): heights.append(int(input())) heights.sort() heights.reverse() count = 0 while H != heights[count]: count += 1 rank = str(count + 1) if rank[-1]=='1': end = 'st' elif rank[-1]=='2': end = 'nd' elif rank[-1]=='3': end = 'rd' else: end = 'th' print(rank+end)