class Work
  attr_reader :x
  attr_reader :s

  def initialize(s, t, x)
    @s = s
    @t = t
    @x = x
  end

  def advance(time)
    @s -= time
    @t -= time
  end

  def doing?
    @s <= @x && @x < @t
  end

  def obsolete?
    @x < 0
  end
end

def road_work(works, people)
  works.sort_by! { |w| w.s }
  ret = []
  prev = 0

  people.each do |p|
    works.each { |w| w.advance(p - prev) }
    works.shift while !works.empty? && works[0].obsolete?
    v = -1
    works.each do |w|
      if w.doing?
        v = w.x
        break
      end
    end
    ret << v
    prev = p
  end

  ret
end

n, q = gets.split.map(&:to_i)
works = []
n.times do
  s, t, x = gets.split.map(&:to_i)
  works << Work.new(s, t, x)
end
people = []
q.times{ people << gets.chomp.to_i }

puts road_work(works, people)