#include #include #include #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #define dump(s) cerr << __LINE__ << "\t:" << #s << " = " << (s) << endl using namespace std; int main () { int H, N; cin >> H >> N; vector v(N); REP (i, 0, N - 1) cin >> v[i]; v[N - 1] = H; sort(v.rbegin(), v.rend()); REP (i, 0, v.size()) { if (v[i] == H) { int rank = i + 1; cout << rank; if (rank % 10 == 1) { cout << "st" << endl; } else if (rank % 10 == 2) { cout << "nd" << endl; } else if (rank % 10 == 3) { cout << "rd" << endl; } else { cout << "th" << endl; } } } return 0; }