#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int h,n;cin >> h >> n; vector a(n); rep(i,n-1) cin >> a.at(i); a.at(n-1)=h; sort(a.rbegin(),a.rend()); int ans=0; rep(i,n){ if(a.at(i)==h) ans=i; } ans++; if(ans%10==1){ cout << ans << "st" << endl; } else if(ans%10==2){ cout << ans << "nd" << endl; } else if(ans%10==3){ cout << ans << "rd" << endl; } else cout << ans << "th" << endl; }