#include using namespace std; int main(){ int H, N; cin >> H >> N; vector h(N - 1); for(auto &hi : h) cin >> hi; sort(h.begin(), h.end()); auto ans = lower_bound(h.begin(), h.end(), H) - h.begin() + N; ans %= N; ans = N - ans; if(ans == 1) cout << ans << "st" << endl; else if(ans == 2) cout << ans << "nd" << endl; else if(ans == 3) cout << ans << "rd" << endl; else cout << ans << "th" << endl; }