h,n = map(int,input().split()) a = list() a.append(h) for i in range(n-1): a.append(int(input())) b = sorted(a, reverse=True).index(h)+1 if b == 1: print(f'{b}st') elif b == 2: print(f'{b}nd') elif b == 3: print(f'{b}rd') else: print(f'{b}th')