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