#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;

#define INF ( 1 << 30 )
typedef multimap<int,int>::iterator itr;

int main()
{
  int N, Q;
  int stmp[1000000], comp[1000000], a;
  char buff[1024];
  scanf( "%d %d", &N, &Q);
  for(int i = 0 ; i < N ; i++ ){
    scanf( "%d", &stmp[i]);
    comp[i] = stmp[i];
  }
  sort( comp, comp + N);

  multimap< int , int > sym;
  while(Q--){
    scanf("%s %d", buff, &a);
    if(*buff == 'A'){ //ADD

      sym.insert(make_pair(stmp[a - 1] , a - 1));

    } else if(*buff == 'R'){ //REMOVE
      try{
        sym.erase( sym.lower_bound( stmp[a - 1]));
      }catch( ... ){}
    } else { //CHECK

      int left = 0, right = INF;
      while(left != right){
        int center = ( left + right ) / 2;
        int pre = 0, BAN = 0;
        for(itr it = sym.begin() ; it != sym.end() ; it++ ){
          int p = distance( comp,lower_bound( comp, comp + N, (*it).first - center));
          BAN += max( p - pre, 0);
          pre = distance( comp, upper_bound( comp, comp + N, (*it).first));
        }
        BAN += max( N - pre, 0);
        if(BAN <= a) right = center;
        else left = center + 1;
      }
      if( left != INF) printf("%d\n", left);
      else puts("NA");

    }
  }
  return false;
}