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 up(i)
    p = i / 2
    return if i <= 1 || @a[p] <= @a[i]
    swap(i, p)
    up(p)
  end

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

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

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

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

ss = Heap.new
es = []
es = STXs.each_with_object([]){|(s, t, x), a| a << [s - x, 0, x] << [t - x, 1, x] if t - x > 0}
es += Ds.map{|d| [d, 2, 0]}
ans = []
es.sort_by(&:first).each do |t, e, x|
  case e
  when 0; ss.add(x)
  when 1; ss.delete(x)
  else;   ans << ss.first
  end
end
puts ans