#!/usr/bin/env ruby
require 'set'

events = []
nn, qq = gets.chomp.split.map(&:to_i)

1.step(nn, 1) do |_i|
  temp = gets.chomp.split.map(&:to_i)
  events.push([temp[0] - temp[2], 0, temp[2]])
  events.push([temp[1] - temp[2], 1, temp[2]])
end

1.step(qq, 1) do |i|
  temp = gets.chomp.to_i
  events.push([temp, 2, i])
end

events.sort_by!(&:first)

ss = SortedSet.new()

ans = []

p events

events.each do |event|
  case event[1]
  when 0
    ss.add event[2]
  when 1
    ss.delete event[2]
  when 2
    if ss.size == 0
      ans[event[2]] = - 1
    else
      ans[event[2]] = ss.min
    end
  end
end

puts ans