#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 high; cin >> high; hs.push_back(high); } sort(hs.begin(), hs.end(), greater()); string suffStr[9] = {"st", "nd", "rd", "th", "th", "th", "th", "th", "th"}; bool isWorst = true; REP(i,hs.size()) { if (hs[i] < h) { int rank = i + 1; string suff = suffStr[rank%10-1]; cout << to_string(rank) + suff << endl; isWorst = false; break; } } if (isWorst) cout << to_string(n) + suffStr[n%10-1] << endl; return 0; }