#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int H, N;
    cin >> H >> N;
    vector<int> vc;
    vc.emplace_back( H );
    int height;
    REP( i, N - 1 )
    {
        cin >> height;
        vc.emplace_back( height );
    }
    sort( ALL( vc ) );
    REP( i, N )
    {
        if( vc[ i ] == H )
        {
            string S = to_string( N - i );
            cout << S;
            cout << ( S[ S.size() - 1 ] == '1' ? "st" : S[ S.size() - 1 ] == '2' ? "nd" : S[ S.size() - 1 ] == '3' ? "rd" : "th" ) << endl;
        }
    }
    return 0;
}