require 'set'
n,q=gets.split.map(&:to_i)
a = n.times.map{gets.split.map(&:to_i)}.flat_map { |e| [ [e[0]-e[2]-1, 0, e[2]] , [e[1]-e[2]-1, 1, e[2]] ] }.sort_by{|sb| sb[0]}
d=$<.map{|s| s.to_i}
x=Set[]
r=Array.new(q,-1)
rr = 0

while a[0][0] < d[0]
    as = a.shift
    if as[1]==0      
        x.add as[2]
    else
        x.delete(as[2])
    end
end
a.each do |e|
    break if rr >=  q
    rp = x.min || -1 if d[rr] <= e[0]
    while d[rr] <= e[0]
        r[rr] = rp
        rr += 1
        break if rr ==  q
    end

    if e[1]==0      
        x.add e[2]
    else
        x.delete(e[2])
    end
end
puts r
