import qualified Data.Set as S
import Data.List
import Control.Monad

getVals :: Read a => IO [a]
getVals = getLine >>= (return . map read . words)
getStrs = getLine >>= (return . words)

f :: (S.Set (Integer, Integer), [Integer]) ->
    Either (Integer, Integer, Integer) Integer ->
    (S.Set (Integer, Integer), [Integer])
f (set, ans) (Left (s, t, x)) = (S.insert (x, t) set, ans)
f (set, ans) (Right d)
    | S.null set = (set, (-1):ans)
    | t-x <= d = f (S.deleteMin set, ans) $ Right d
    | otherwise = (set, x:ans)
    where (x, t) = S.findMin set

solve :: [[Integer]] -> [Integer] -> [Integer]
solve stxs ds = take (length ds) $ repeat 0
--solve stxs ds = reverse $ snd $ foldl f (S.empty, []) way
    where
        wayTo = [Left (s, t, x) | [s, t, x] <- stxs]
        wayFrom = [Right d | d <- ds]
        way = sortBy cmp $ wayTo ++ wayFrom
        Left (s1, t1, x1) `cmp` Left (s2, t2, x2) = compare (s1-x1) (s2-x2)
        Left (s, t, x) `cmp` Right d
            | s-x == d = LT
            | otherwise = compare (s-x) d
        Right d1 `cmp` Right d2 = compare d1 d2

main = do
    [n, q] <- getVals
    stxs <- replicateM n getVals
    ds <- replicateM q $ getVals >>= (return . head)
    mapM_ print $ solve stxs ds
