#include #include #include #include #include #include using namespace std; #define REP(i, j) for (int i = 0; i < (int)j; ++i) #define FOR(i, j, k) for (int i = (int)j; i < (int)k; ++i) #define SORT(v) sort(v.begin(), v.end()) #define REVERSE(v) reverse(v.begin(), v.end()) typedef complex P; typedef vector VI; typedef long long LL; typedef pair PII; int main() { cin.tie(0); ios::sync_with_stdio(false); int h, n; cin >> h >> n; VI hs; REP(i,n-1) { int hn; cin >> hn; hs.push_back(hn); } SORT(hs); bool isFirst = true; string s[3] = {"st", "nd", "rd"}; REP(i,n-1) { if (h < hs[i]) { string suff = "th"; int rank = n - i; if (rank%10 < 4) suff = s[rank-1]; cout << to_string(rank) + suff << endl; isFirst = false; break; } } if (isFirst) cout << "1st" << endl; return 0; }