nn, qq = gets.split.map(&:to_i)
stx = []
nn.times{ stx << gets.split.map(&:to_i) }
stx.sort!{|a,b| a[2] <=> b[2] }
dd = readlines.map{ |i| i.chomp.to_i }

ans = Array.new(qq,-1)
stx.each do |s,t,x|
  # 誰も止めない
  next if t-x<1

  ng_start = (s-x>0 ? s-x : 0)
  ng_end = t-x-1

  ng_start.upto(ng_end) do |time|
    idx = dd.bsearch_index{|x| x > time-1}
    break if idx.nil?
    # 値がないなら更新
    if dd[idx] == time && ans[idx] == -1
      ans[idx] = x
    end
  end
end

puts ans.join("\n")
