#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int H, N; cin >> H >> N; vector X(N); X[0] = H; for (int i = 1; i < N; i++) { cin >> X[i]; } sort(X.begin(), X.end(), greater()); for (int i = 0; i < N; i++) { if (H == X[i]) { cout << i + 1; switch ((i + 1) % 10) { case 1: cout << "st" << '\n'; break; case 2: cout << "nd" << '\n'; break; case 3: cout << "rd" << '\n'; break; default: cout << "th" << '\n'; } break; } } return 0; }