n,q = gets.chomp.split(" ")
ss, ts, xs = [], [], []
n.to_i.times do
  s, t, x = gets.chomp.split(" ")
  ss.push(s.to_i)
  ts.push(t.to_i)
  xs.push(x.to_i)
end

res = []
q.to_i.times do |i|
  starttime = gets.to_i
  score = -1
  n.to_i.times do |j|
    tmp = starttime + xs[j]
    if ss[j].to_i <= tmp && tmp < ts[j].to_i
      score = xs[j]
      break
    end
  end
  res.push(score)
end

p res