#! /usr/bin/env python3 H, N = map(int, input().split()) A = sorted([int(input()) for x in range(N-1)]+[H]) i = N - 1 - A.index(H) if i < 3: print(str(i+1) + ['st', 'nd', 'rd'][i]) else: print(str(i+1) + 'th')