#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
typedef pair<int,int> pii;

const int MAX_N = 1000100;
const int INF = 1e9 + 100;

int N,Q,a,r[MAX_N],S[MAX_N];
pii s[MAX_N];
string query;
vector<int> leader,score;

int check(int x){
  int l = -1, r = INF;
  while(r-l>1){
    int m = (l+r)/2, p = -1;
    int num = 0;
    rep(i,score.size()){
      int L = lower_bound(S,S+N,score[i]-m) - S;
      num += max(0,L-(p+1));
      int R = upper_bound(S,S+N,score[i]) - S - 1;
      p = R;
    }
    num += N-(p+1);
    if(num<=x)r = m;
    else l = m;
  }
  return r;
}

int main(){
  cin.tie(0);
  std::ios::sync_with_stdio(0);
  cin >> N >> Q;
  rep(i,N)cin >> s[i].first, s[i].second = i;
  sort(s,s+N);
  rep(i,N)r[s[i].second] = i, S[i] = s[i].first;

  rep(hoge,Q){
    cin >> query >> a;
    if(query == "ADD"){
      leader.push_back(a-1);
    }else if(query == "REMOVE"){
      rep(i,leader.size()){
	if(leader[i] == a-1){
	  leader.erase(leader.begin()+i);
	  break;
	}
      }
    }else{
      score.resize(leader.size());
      rep(i,score.size())score[i] = S[r[leader[i]]];
      sort(score.begin(),score.end());

      int r = check(a);
      if(r>=INF-1)cout << "NA" << endl;
      else cout << r << endl;
    }
  }
}