#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    vector<int> s(n);
    vector<pair<int, int> > s2(n);
    for(int i=0; i<n; ++i){
        cin >> s[i];
        s[i] = 1000000000 - s[i];
        s2[i] = make_pair(s[i], i);
    }
    sort(s.begin(), s.end());
    sort(s2.begin(), s2.end());

    vector<int> index(n);
    for(int i=0; i<n; ++i)
        index[s2[i].second] = i;

    set<int> leader;
    while(--q >= 0){
        string query;
        int x;
        cin >> query >> x;

        if(query == "ADD"){
            leader.insert(index[x-1]);
            continue;
        }
        if(query == "REMOVE"){
            leader.erase(index[x-1]);
            continue;
        }

        vector<int> v(leader.begin(), leader.end());
        for(unsigned i=0; i<v.size(); ++i)
            v[i] = lower_bound(s.begin(), s.end(), s[v[i]]) - s.begin();

        v.push_back(n);
        int rLeft = 0;
        int rRight = 1000000000 + 1;
        while(rLeft < rRight){
            int rMid = (rLeft + rRight) / 2;
            int cnt = v[0];
            for(unsigned i=1; i<v.size(); ++i)
                cnt += s.begin() + v[i] - upper_bound(s.begin() + v[i-1], s.begin() + v[i], s[v[i-1]] + rMid);
            if(cnt <= x)
                rRight = rMid;
            else
                rLeft = rMid + 1;
        }
        if(rLeft <= 1000000000)
            cout << rLeft << endl;
        else
            cout << "NA" << endl;
    }

    return 0;
}