N, Q = gets.split.map(&:to_i)
STXs = N.times.map{gets.split.map(&:to_i)}
Ds = Q.times.map{gets.to_i}

class Heap
  def initialize
    @a = [nil]
    @h = {}
  end

  def swap(i, j)
    @a[i], @a[j] = @a[j], @a[i]
    @h[@a[i]], @h[@a[j]] = i, j
  end

  def b_up(i)
    p = i / 2
    return if i <= 1 || @a[p] <= @a[i]
    swap(i, p)
    b_up(p)
  end

  def add(v)
    return if @h[v]
    @a << v
    @h[v] = @a.size - 1
    b_up(@a.size - 1)
  end

  def b_dn(i)
    c = i * 2
    return if c >= @a.size
    c += 1 if c != @a.size - 1 && @a[c] > @a[c + 1]
    return if @a[i] <= @a[c]
    swap(i, c)
    b_dn(c)
  end

  def delete(v)
    return unless i = @h[v]
    u = @a[-1]
    swap(i, -1)
    ret = @a.pop
    @h[ret] = nil
    v > u ? b_up(i) : b_dn(i)
    ret
  end

  def first
    @a[1] || -1
  end
end

ds, s = Ds.dup, Heap.new
es = (STXs.flat_map{|s, t, x| [[s - x - 0.5, 1, x], [t - x - 0.5, -1, x]]} + Ds.map{|d| [d, 0, nil]}).sort_by(&:first)
es.each do |t, e, x|
  case e
  when 1
    s.add(x)
  when -1
    s.delete(x)
  else
    puts s.first
  end
end