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