### constant

MAX_INT = (1 << 30)

### main

n, q = gets.strip.split(' ').map{|s| s.to_i}

scores = n.times.map{gets.strip.to_i}
s_scores = scores.sort
#p scores

leaders = []
rmins = []

q.times do
  query, xstr = gets.strip.split(' ')
  x = xstr.to_i
  #p [query, x]

  case query
  when 'ADD'
    leaders << (x - 1)
    rmins = []
    #p ["leaders", leaders]
    next
  when 'REMOVE'
    leaders.delete (x - 1)
    rmins = []
    #p ["leaders", leaders]
    next
  end

  ## CHECK
  if rmins.empty?
    ls_enum = leaders.map{|li| scores[li]}.sort.to_enum
    ls = -1
    rmins = []

    for s in s_scores
      if ls.nil?
        rmins << MAX_INT
      else
        while ls < s
          begin
            ls = ls_enum.next
          rescue
            ls = nil
            break
          end
        end

        rmins << (ls.nil? ? MAX_INT : ls - s)
      end
    end

    rmins.sort!{|a, b| b <=> a}
  end
  #p rmins

  rmin = x >= n ? 0 : rmins[x]
  puts (rmin >= MAX_INT ? 'NA' : rmin)
end