#include using namespace std; int main() { int H, N; cin >> H >> N; vector> v(N, vector(2, 0)); v.at(0).at(0) = H; v.at(0).at(1) = 1; for (int i = 1; i < N; i++) { cin >> v.at(i).at(0); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); int n = 0; for (int i = 0; i < N; i++) { //cout << v.at(i).at(0) << v.at(i).at(1) << endl; if (v.at(i).at(1) == 1) { n = i + 1; break; } } int x = n % 10; string s; if (x == 0) s = "th"; if (x == 1) s = "st"; if (x == 2) s = "nd"; if (x == 3) s = "rd"; if (x > 3) s = "th"; cout << n << s << endl; }