H,N = [int(i) for i in input().split()] h = [] for i in range(N-1): h.append(int(input())) h.sort() #print(h) high = len(h) low = 0 while(high > low): mid = (low + high)//2 if h[mid] >= H: high = mid if h[mid] < H: low = mid + 1 if (N-low) % 10 == 1: print(str(N-low)+'st') elif (N - low) % 10 == 2: print(str(N - low) + 'nd') elif (N - low) % 10 == 3: print(str(N - low) + 'rd') else: print(str(N-low)+'th')