h, n = map(int, input().split()) ls = [h] for i in range(n-1): ls.append(int(input())) ls.sort() ls.reverse() r = ls.index(h) + 1 if str(r)[-1] == 1: print(str(r)+"st") elif str(r)[-1] == 2: print(str(r)+"nd") elif str(r)[-1] == 3: print(str(r)+"rd") else: print(str(r)+"th")