h,n = map(int,input().split()) line = [int(input()) for _ in range(n - 1)] line.append(h) line_so = sorted(line,reverse=True) if line_so.index(h) + 1 == 1: print('1st') elif line_so.index(h) + 1 == 2: print('2nd') elif line_so.index(h) + 1 == 3: print('3rd') else: print(f"{line_so.index(h) + 1}th")