N, Q = gets.split.map &:to_i
STX = N.times.map{
  gets.split.map &:to_i
}
D = $<.map &:to_i

A = STX.map{|s, t, x|
  [s - x, t - x, x]
}.sort_by{|from, to, x| [x, from, to] }

D.each{|d|
  from, to, x = A.find{|from, to, x|
    from <= d && d < to
  }
  if x.nil?
    p -1
  else
    p x
  end
}
