i = input().rstrip().split(" ") #取得 #身長0 人数i[1] - 1 n = 0 for k in range(int(i[1]) - 1): s = int(input()) if int(i[0]) < s: n += 1 if n == 0: print("1st") elif n == 1: print("2nd") elif n == 2: print("3rd") else: print(str(int(n) + 1) + "th")