n,q = gets.split.map(&:to_i)
stx = Array.new(n){ gets.split.map(&:to_i) }
d = Array.new(q){ gets.to_i }

a = stx.map{|s,t,x|[s-x,t-x,x]}.sort_by{|a|a[2]}
d.each do |d|
  nop = true
  a.find do |a|
    if a[0] <= d && d < a[1]
      puts a[2]
      nop = false
      break
    end
  end
  puts -1 if nop
end
