import qualified Data.ByteString.Char8 as B
import qualified Data.Set as S
import Data.Maybe
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 :: (S.Set (Int, Int), [Int]) -> Elem ->
    (S.Set (Int, Int), [Int])
f (set, ans) (Left (_, 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 :: [[Int]] -> [Int] -> [Int]
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

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
