n, q = gets.split(" ").map(&:to_i)

stx = []
n.times do |i|
  stx[i] = gets.split(" ").map(&:to_i)
  stx[i][0] -= stx[i][2]
  stx[i][1] -= stx[i][2]
end

di = []
q.times do |i|
  d = gets.to_i
  di << [d, i]
end

stx = stx.sort_by{|s,t,x| x}
ans = [-1]*(q)

stx.each_with_index do |(s,t,x),i|
  lb = di.bsearch_index{|d,_| d >= s}
  next if lb.nil?
  while lb < di.length && di[lb][0] <  t
    ans[di[lb][1]] = x
    di.delete_at(lb)
  end
end

puts ans
