H, N = map(int, input().split()) ans = 1 for _ in range(N-1): if int(input()) > H: ans += 1 dic = {1: 'st', 2: 'nd', 3: 'rd'} print(str(ans) + dic.get(ans%10, 'th'))