N, Q = gets.split.map(&:to_i)
STXs = N.times.map{gets.split.map(&:to_i)}
Ds = Q.times.map{gets.to_i}

stxs = STXs.sort_by(&:last)
rs = stxs.map{|s, t, x| s - x ... t - x}
Ds.each do |d|
  i = rs.index{|r| r.include?(d)}
  puts i.nil? ? -1 : stxs[i].last
end