# your code goes here
H, N = list(map(int, input().split()))
Hs = [int(input()) for i in range(N-1)]
Hs.sort()
rank = 1
for i, Hi in enumerate(Hs[::-1], start=1):
	if Hi < H:
		break
	else:
		rank+=1

if rank==1:
	print('1st')
elif rank==2:
	print('2nd')
elif rank==3:
	print('3rd')
else:
	print(str(rank)+'th')