n,q=gets.split.map(&:to_i)
s=n.times.map{gets.split.map(&:to_i)}
d=q.times.map{gets.to_i}
s.map!{|m| [m[0]-m[2],m[1]-m[2]-1,m[2]]}.sort_by!{|sb|[sb[1],sb[2]]}
sss = s
ll = d.map do |m|
    while sss != [] && sss[0][1] < m
        sss.shift
    end
    sll = sss&.find { |ss| ss[0] <= m}&.at(2)
    l = sll || -1
end
puts ll
