import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import Data.Function
import Data.Ord
--import Debug.Trace

main :: IO ()
main = readLine >>= main'
    where
        main' [n, q] = inputs >>= printRes . uncurry solve  
            where
                inputs = (,) <$> readContents n <*> replicateM q (head <$> readLine) 
        printRes = mapM_ print 

solve :: [[Int]] -> [Int] -> [Int]
solve stxs = map check 
    where
        check d = val . edit $ binarySearch (E (d, inf)) vs
            where
                edit (Right i) = vs V.! i
                edit (Left i ) = vs V.! (i - 1)

        vs = V.fromList . map mf . {-traceShowId . build'-} build . sortBy cmpf $ [-inf, inf, inf] : map mf2 stxs
            where
                mf2 [s, t, x] = [s - x, t - x, x]

                cmpf lhs rhs = comparing head lhs rhs `mappend` comparing last lhs rhs

                mf (s, x)
                    | x < inf = E (s, x)
                    | otherwise = E (s, -1)

                build (x@[s0, t0, x0] : y@[s1, t1, x1] : zs)
                    | t0 < s1 = (s0, x0) : build (ordf $ [t0, s1, inf] : y : zs)
                    | t0 == s1 = (s0, x0) : build (y : zs)
                    | t0 < t1 && x0 < x1 = (s0, x0) : build (ordf $ [t0, t1, x1] : zs)
                    | t0 < t1 = (s0, x0) : build (y : zs)
                    | x0 < x1 = build $ x : zs
                    | otherwise = (s0, x0) : build (ordf $ [t1, t0, x0] : y : zs)
                build [[s, _, x]] = [(s, x)]
                build _ = []

                --build' = build . traceShowId

                ordf (x@[s0, _, x0] : y@[s1, _, x1] : zs)
                    | s0 < s1 = x : y : zs
                    | s0 > s1 || x0 > x1 = y : ordf (x : zs)
                    | otherwise = x : y : zs
                ordf xs = xs

        inf = 10 ^ 10

        val (E (_, v)) = v

newtype E = E (Int, Int) 
    deriving (Eq)

instance Ord E where
    compare (E lhs) (E rhs) = compare lhs rhs

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

binarySearch :: (Ord a) => a -> V.Vector a -> Either Int Int
binarySearch k xs
    | V.null xs = Left 0
    | otherwise = bsf 0 $ V.length xs
    where
        bsf base size
            | size > 1 && mv > k = bsf base $ size - half
            | size > 1 = bsf mid $ size - half
            | bv == k = Right base
            | bv < k = Left $ base + 1
            | otherwise = Left base
            where
                half = size `div` 2
                mid = base + half
                bv = xs V.! base
                mv = xs V.! mid