import Data.List
import Data.Array
import Control.Monad



modifier::[(Int,Int,Int)]->[(Int,Int,Int)]
modifier  = sortBy (\ (_,_,x)  -> \(_,_,x') ->compare x x') . map (\ (s,t,x) -> (s-x,t-x,x))

logger::(Int,Int)->[(Int,Int,Int)]->[(Int,Int)]
logger (this_expire,now_val) [] = []
logger (this_expire,now_val) ((s,expire,val):rest) = if s>this_expire then (this_expire,10^10):(logger (10^10,10^10) rest) else
                                                case  (val <= now_val , expire <= this_expire) of
                                                (False, True )-> logger (this_expire,now_val) rest
                                                (False, False)-> (this_expire,val):(logger (expire,val) rest)
                                                (True , True )-> (s,val):(logger (expire,val) ((s,this_expire,now_val):rest))
                                                (True , False)-> (s,val):(logger (expire,val) rest)



gen_change_ar::[(Int,Int)] -> Array Int (Int,Int)
gen_change_ar ls = listArray (1,length ls) ls


binser::Array Int (Int,Int)->Int->(Int,Int)->Int
binser ar v (l,r)= if l+1 == r then snd (ar!l)
                               else let c = div (l + r) 2 in
                                    if fst (ar!c)> v then binser ar v (l,c)
                                                     else binser ar v (c,r)


solver::Array Int (Int,Int)->Int->Int
solver ar v = binser ar v (bounds ar)

main::IO()
main=do
  n:q:_ <- return. map read .words =<< getLine
  dat<-forM [1..n] (\_->return. (\ (s:t:x:_)->(s,t,x)). map read. words =<< getLine)
  let ar = gen_change_ar ((-(10^10),10^10):(logger (10^10,10^10) (modifier dat))++[(10^10,10^10)])
  forM_ [1..q] (\_->print.(\ v-> if v>=10^10 then (-1) else v).solver ar.read=<<getLine)