# -*- coding: utf-8 -*- H,N = map(int, input().split()) h = [H] for i in range(N-1): h.append(int(input())) h.sort(reverse=True) order = h.index(H) + 1 r = order % 10 if r==1: print(str(order)+'st') elif r==2: print(str(order)+'nd') elif r==3: print(str(order)+'rd') else: print(str(order)+'th')