nn, qq = gets.split.map(&:to_i)
events = []
temp = []
1.step(nn, 1) do |_i|
  temp = gets.split.map(&:to_i)
  next if temp[1] - temp[2] <= 0
  x = temp[0] - temp[2]
  x = x > 0 ? x : 0

  events.push([temp[1] - temp[2], 1, temp[2]])
  events.push([temp[0] - temp[2], 0, temp[2]])
end
1.step(qq, 1) do |i|
  events.push([gets.to_i, 2, i])
end
events.sort_by!(&:first)

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

ss = Heap.new
ans = []

events.each do |event|
  if event[1] == 0
    ss.add(event[2])
  elsif event[1] == 1
    ss.delete(event[2])
  else
    ans[event[2]] = ss.first
  end
end

puts ans[1..-1]