### constant

MAX_INT = (1 << 30)

### main

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

scores = n.times.map{gets.strip.to_i}
#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?
    for i in (0...n)
      rmin = MAX_INT
      s = scores[i]

      for li in leaders
        r = scores[li] - s
        if r >= 0 && rmin > r
          rmin = r
        end
      end

      rmins << rmin
    end

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

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