#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; void solve() { int N, H; cin >> H >> N; vector v(N); v[0] = H; rep(i, 1, N) { cin >> v[i]; } sort(v.begin(), v.end(), greater()); string ordinal = "th"; rep(i, 0, N) { if (v[i] == H) { if ((i + 1) % 10 == 1) ordinal = "st"; if ((i + 1) % 10 == 2) ordinal = "nd"; if ((i + 1) % 10 == 3) ordinal = "rd"; cout << i + 1 << ordinal << endl; return; } } } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); getchar(); }