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