import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.Bits
import Data.List
import Control.Monad

getVals :: Read a => IO [a]
getVals = map read . words <$> getLine
getStrs :: IO [String]
getStrs = words <$> getLine
readInts :: IO [Int]
readInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

type Elem = Either (Int, Int, Int) Int

f :: (PriorityQ Int Int, [Int]) -> Elem ->
    (PriorityQ Int Int, [Int])
f (heap, ans) (Left (_, t, x)) = (pushPQ x t heap, ans)
f (heap, ans) (Right d) = case peekMinPQ heap of
    Nothing -> (heap, (-1):ans)
    Just (x, t) | t-x <= d -> f (deleteMinPQ heap, ans) $ Right d
    Just (x, _) -> (heap, x:ans)

solve :: [[Int]] -> [Int] -> [Int]
solve stxs ds = reverse $ snd $ foldl f (emptyPQ, []) way
    where
        wayTo = [Left (s, t, x) | [s, t, x] <- stxs]
        wayFrom = [Right d | d <- ds]
        way = sortBy cmp $ wayTo ++ wayFrom

cmp :: Elem -> Elem -> Ordering
Left (s1, _, x1) `cmp` Left (s2, _, x2) = compare (s1-x1) (s2-x2)
Left (s, _, x) `cmp` Right d
    | s-x == d = LT
    | otherwise = compare (s-x) d
Right d `cmp` Left stx = flipOrd $ Left stx `cmp` Right d
Right d1 `cmp` Right d2 = compare d1 d2

flipOrd :: Ordering -> Ordering
flipOrd EQ = EQ
flipOrd GT = LT
flipOrd LT = GT

main :: IO ()
main = do
    [n, q] <- map fromIntegral <$> readInts
    stxs <- replicateM n readInts :: IO [[Int]]
    ds <- replicateM q $ head <$> readInts
    mapM_ print $ solve stxs ds


data PriorityQ k v = Mt | Br !k v !(PriorityQ k v) !(PriorityQ k v)
    deriving (Eq, Ord, Read, Show)

emptyPQ :: PriorityQ k v
emptyPQ = Mt

peekMinPQ :: PriorityQ k v -> Maybe (k, v)
peekMinPQ Mt           = Nothing
peekMinPQ (Br k v _ _) = Just (k, v)

pushPQ :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v
pushPQ wk wv Mt = Br wk wv Mt Mt
pushPQ wk wv (Br vk vv pl pr)
    | wk <= vk  = Br wk wv (pushPQ vk vv pr) pl
    | otherwise = Br vk vv (pushPQ wk wv pr) pl

siftdown :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v -> PriorityQ k v
siftdown wk wv Mt _          = Br wk wv Mt Mt
siftdown wk wv (pl @ (Br vk vv _ _)) Mt
    | wk <= vk               = Br wk wv pl Mt
    | otherwise              = Br vk vv (Br wk wv Mt Mt) Mt
siftdown wk wv pl@(Br vkl vvl pll plr) pr@(Br vkr vvr prl prr)
    | wk <= vkl && wk <= vkr = Br wk wv pl pr
    | vkl <= vkr             = Br vkl vvl (siftdown wk wv pll plr) pr
    | otherwise              = Br vkr vvr pl (siftdown wk wv prl prr)

deleteMinPQ :: (Ord k) =>  PriorityQ k v -> PriorityQ k v
deleteMinPQ Mt             = Mt
deleteMinPQ (Br _ _ pr Mt) = pr
deleteMinPQ (Br _ _ Mt pl) = pl
deleteMinPQ (Br _ _ (Br vk vv pll plr) pr) = siftdown k v pr npl where
    (k, v, npl) = leftrem vk vv pll plr
    leftrem wk wv Mt Mt = (wk, wv, Mt) 
    leftrem wk wv (Br uk uv _ _) Mt = (uk, uv, Br wk wv Mt Mt)
    leftrem wk wv Mt (Br uk uv _ _) = (uk, uv, Br wk wv Mt Mt)
    leftrem wk wv (Br k v pll plr) upr = let (k, v, npl) = leftrem k v pll plr in
                        (k, v, Br wk wv upr npl)