#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int H,N;cin>>H>>N;
    vint A(N-1);rep(i,N-1)cin>>A[i];
    sort(all(A));

    int tmp=lower_bound(all(A),H)-A.begin();
    tmp=N-tmp;
    cout<<tmp;
    if(tmp%10==1)cout<<"st"<<endl;
    else if(tmp%10==2)cout<<"nd"<<endl;
    else if(tmp%10==3)cout<<"rd"<<endl;
    else cout<<"th"<<endl;
    return 0;
}