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 del(v)
    swap(@h[v], -1)
    ret = @a.pop
    @h[ret] = nil
    b_dn(1)
    ret
  end

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

ds, ss, i = Ds.sort, Heap.new, 0
STXs.flat_map{|s, t, x| [[s - x, x, 1], [t - x, x, -1]]}.sort_by(&:first).each do |t, x, e|
  j = (i ... Q).find{|j| ds[j] >= t}
  break unless j
  if j > i
    m = ss.top
    (j - i).times{puts m}
    i = j
  end
  if e == 1
    ss.add(x)
  else
    ss.del(x)
  end
end
m = ss.top
ds[i .. -1].each{puts m}