#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
const int inf = 1 << 30;
const int ma = 1e6 + 1;
using namespace std;
typedef pair< int, int > P;
int n,q;
int s[ma],idx[ma];
vector< P > acs(ma);
int main()
{
    cin >> n >> q;
    for( int i = 0; i < n; i++ )
    {
        cin >> s[i];
        acs[i] = P( s[i], i );
    }
    sort( begin(acs), begin(acs) + n );
    for( int i = 0; i<n; i++ )idx[acs[i].second] = i;
    set< int > leader;
    while( q-- )
    {
        string t;
        cin >> t;
        int a, x;

        if( t=="ADD")
        {
            cin >> a;
            leader.insert(a - 1);
        }
        else if(t=="REMOVE")
        {
            cin >> a;
            leader.erase(a - 1);

        }
        else
        {

            int ng = -1,ok = inf;
            bool flag = 0;
            vector< int> pos;
            cin >> x;
            for( auto &d : leader )pos.emplace_back( idx[d] );
            sort( begin(pos), end(pos ) );
            while( abs( ng - ok) > 1)
            {
                int r = ( ng + ok ) / 2;
                int cnt = 0;
                ///何処まで
                int covered = -1;
                for( auto right : pos )
                {
                    int left = lower_bound( begin(acs), begin(acs) + n, make_pair( acs[right].first - r, -inf ) ) - begin(acs);
                    right = upper_bound( begin(acs), begin( acs ) + n, make_pair( acs[right].first , inf ) ) - begin(acs) - 1;

                    left = max( covered + 1, left );
                    cnt += right - left + 1;
                    covered = right;
                }
                if( (n - x) <= cnt )
                {
                    ok = r;
                    flag = 1;
                }
                else
                {
                    ng = r;
                }
                
            }
            if( flag )cout << ok << endl;
            else cout << "NA" << endl;
        }
    }
    return 0;
}
