module Main where

import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust, mapMaybe)
import Control.Monad (replicateM, forM_, foldM)
import qualified Data.Vector.Unboxed.Mutable as UMV
import Data.List (sortOn, sort)
import Debug.Trace

readTuple2 :: IO (Int, Int)
readTuple2 = do
    [x, y] <- readInts
    pure (x, y)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [x, y, z] <- readInts
    pure (x, y, z)

readInts :: IO [Int]
readInts = do
    is <- BC.words <$> BC.getLine
    pure $ fst <$> mapMaybe BC.readInt is

readInt :: IO Int
readInt = do
    is <- BC.getLine
    pure $ fst $ fromJust $ BC.readInt is

main = do
    (n, q) <- readTuple2
    works <- replicateM n readTuple3
    startTimes <- replicateM q readInt
    let maxT = maximum $ fmap (\(s, t, x) -> t) works
    let maxX = maximum $ fmap (\(s, t, x) -> x) works
    let vecSize = maxT * 2 - maxX * 2 + 1
    vec <- UMV.replicate vecSize (negate 1)
    forM_ works $ \(s, t, x) -> do
        let maxStart = max 0 $ s * 2 - 1 - x * 2
        let minEnd = min vecSize $ t * 2 - 1 - x * 2
        forM_ [maxStart..minEnd] $ \point -> do
            currentData <- UMV.read vec point
            if currentData == -1 then
                UMV.write vec point x
            else if currentData > x then
                UMV.write vec point x
            else
                pure ()
    forM_ startTimes $ \t -> 
        if t * 2 > vecSize then putStrLn "-1"
        else
            UMV.read vec (t * 2) >>= print

