#include "bits/stdc++.h" using namespace std; using Graph = vector>; typedef long long ll; typedef pair P; #define rep(i,n) for (ll i = 0; i < (n); ++i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const long long mod = 1e9 + 7; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll h, n; cin >> h >> n; vector v(n); rep(i, n-1) { cin >> v[i]; } v[n-1]=h; sort(rall(v)); string ans=""; rep(i, n - 1) { if (v[i] == h) { ans+=to_string(i+1); break; } } if (ans[ans.size() - 1] == '1') { ans += "st"; } else if (ans[ans.size() - 1] == '2') { ans += "nd"; } else if (ans[ans.size() - 1] == '3') { ans += "rd"; } else { ans+="th"; } cout << ans << endl; }