import sys
input = sys.stdin.readline
INF = (1<<31)
from bisect import bisect_left

class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st)) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline INF = (1<<31) INF 1<<31 1 31 from bisect import bisect_left class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) LazySegmentTree def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
     __init__ self.N = Q self.N self N Q self.tree = [INF]*(2*self.N) self.tree self tree [INF]*(2*self.N) [INF] INF 2*self.N 2 self.N self N self.lazy = [INF]*(2*self.N) self.lazy self lazy [INF]*(2*self.N) [INF] INF 2*self.N 2 self.N self N self self Q Q def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
     _evaluate H = K.bit_length() - 1 H K.bit_length() - 1 K.bit_length() K.bit_length K bit_length 1 for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
     i range(H,0,-1) range H 0 -1 h = K >> i h K >> i K i if self.lazy[h] == INF:
                continue
             self.lazy[h] == INF self.lazy[h] self.lazy self lazy h INF continue self.tree[h] = min(self.tree[h],self.lazy[h]) self.tree[h] self.tree self tree h min(self.tree[h],self.lazy[h]) min self.tree[h] self.tree self tree h self.lazy[h] self.lazy self lazy h self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h]) self.lazy[h << 1] self.lazy self lazy h << 1 h 1 min(self.lazy[h << 1],self.lazy[h]) min self.lazy[h << 1] self.lazy self lazy h << 1 h 1 self.lazy[h] self.lazy self lazy h self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h]) self.lazy[h << 1|1] self.lazy self lazy h << 1|1 h << 1 h 1 1 min(self.lazy[h << 1|1],self.lazy[h]) min self.lazy[h << 1|1] self.lazy self lazy h << 1|1 h << 1 h 1 1 self.lazy[h] self.lazy self lazy h self.lazy[h] = INF self.lazy[h] self.lazy self lazy h INF self self K K def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

     _caluculate while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

     K > 1 K 1 K >>= 1 K 1 self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1]) self.tree[K] self.tree self tree K min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1]) min self.tree[K] self.tree self tree K self.tree[K<<1] self.tree self tree K<<1 K 1 self.lazy[K<<1] self.lazy self lazy K<<1 K 1 self.tree[K<<1|1] self.tree self tree K<<1|1 K<<1 K 1 1 self.lazy[K<<1|1] self.lazy self lazy K<<1|1 K<<1 K 1 1 self self K K def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
     range_update L += self.N L self.N self N R += self.N R self.N self N L0 = L//(L & -L) L0 L//(L & -L) L L & -L L -L L R0 = R//(R & -R) - 1 R0 R//(R & -R) - 1 R//(R & -R) R R & -R R -R R 1 while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
         L < R L R if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
             L&1 L 1 self.lazy[L] = min(self.lazy[L],M) self.lazy[L] self.lazy self lazy L min(self.lazy[L],M) min self.lazy[L] self.lazy self lazy L M L += 1 L 1 if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
             R&1 R 1 R -= 1 R 1 self.lazy[R] = min(self.lazy[R],M) self.lazy[R] self.lazy self lazy R min(self.lazy[R],M) min self.lazy[R] self.lazy self lazy R M L >>= 1 L 1 R >>= 1 R 1 self._caluculate(L0) self._caluculate self _caluculate L0 self._caluculate(R0) self._caluculate self _caluculate R0 self self L L R R M M def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
     range_query L += self.N L self.N self N R += self.N R self.N self N L0 = L//(L & -L) L0 L//(L & -L) L L & -L L -L L R0 = R//(R & -R) - 1 R0 R//(R & -R) - 1 R//(R & -R) R R & -R R -R R 1 self._evaluate(L0) self._evaluate self _evaluate L0 self._evaluate(R0) self._evaluate self _evaluate R0 v = INF v INF while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
         L < R L R if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
             L&1 L 1 v = min(v,self.tree[L],self.lazy[L]) v min(v,self.tree[L],self.lazy[L]) min v self.tree[L] self.tree self tree L self.lazy[L] self.lazy self lazy L L += 1 L 1 if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
             R&1 R 1 R -= 1 R 1 v = min(self.tree[R],self.lazy[R],v) v min(self.tree[R],self.lazy[R],v) min self.tree[R] self.tree self tree R self.lazy[R] self.lazy self lazy R v L >>= 1 L 1 R >>= 1 R 1 return v v self self L L R R '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    ''' def debug(self):
        print(self.lazy)
        print(self.tree)
    
     debug print(self.lazy) print self.lazy self lazy print(self.tree) print self.tree self tree self self def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) __str__ for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
         i range(self.N) range self.N self N self.tree[i] = min(self.tree[i],self.lazy[i]) self.tree[i] self.tree self tree i min(self.tree[i],self.lazy[i]) min self.tree[i] self.tree self tree i self.lazy[i] self.lazy self lazy i self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i]) self.lazy[i << 1] self.lazy self lazy i << 1 i 1 min(self.lazy[i << 1],self.lazy[i]) min self.lazy[i << 1] self.lazy self lazy i << 1 i 1 self.lazy[i] self.lazy self lazy i self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i]) self.lazy[i << 1|1] self.lazy self lazy i << 1|1 i << 1 i 1 1 min(self.lazy[i << 1|1],self.lazy[i]) min self.lazy[i << 1|1] self.lazy self lazy i << 1|1 i << 1 i 1 1 self.lazy[i] self.lazy self lazy i self.lazy[i] = INF self.lazy[i] self.lazy self lazy i INF for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
         i range(self.N,self.N*2) range self.N self N self.N*2 self.N self N 2 self.tree[i] = min(self.tree[i],self.lazy[i]) self.tree[i] self.tree self tree i min(self.tree[i],self.lazy[i]) min self.tree[i] self.tree self tree i self.lazy[i] self.lazy self lazy i k if k < INF else -1 for k in self.tree[self.N:] for k in self.tree[self.N:] k self.tree[self.N:] self.tree self tree self.N: self.N self N for k in self.tree[self.N:] k if k < INF else -1 k < INF k INF k -1 return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) '\n'.join '\n' join map(str,[k if k < INF else -1 for k in self.tree[self.N:]]) map str [k if k < INF else -1 for k in self.tree[self.N:]] self self N,Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q tuple(map(int,input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split roadwork = [tuple(map(int,input().split())) for _ in range(N)] roadwork [tuple(map(int,input().split())) for _ in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] st = LazySegmentTree(Q) st LazySegmentTree(Q) LazySegmentTree Q for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x) s t x roadwork l = bisect_left(D,s - x) l bisect_left(D,s - x) bisect_left D s - x s x r = bisect_left(D,t - x) r bisect_left(D,t - x) bisect_left D t - x t x st.range_update(l,r,x) st.range_update st range_update l r x print(str(st)) print str(st) str st Q = map(int,input().split()) map(int,input().split()) Q l = bisect_left(D,s - x) bisect_left(D,s - x) l input = sys.stdin.readline sys.stdin.readline input D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D r = bisect_left(D,t - x) bisect_left(D,t - x) r roadwork = [tuple(map(int,input().split())) for _ in range(N)] [tuple(map(int,input().split())) for _ in range(N)] roadwork INF = (1<<31) 1<<31 INF class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]])) LazySegmentTree N,Q = map(int,input().split()) map(int,input().split()) N st = LazySegmentTree(Q) LazySegmentTree(Q) st
import sys
input = sys.stdin.readline
INF = (1<<31)
from bisect import bisect_left

class LazySegmentTree():

    def __init__(self,Q):
        self.N = Q
        self.tree = [INF]*(2*self.N)
        self.lazy = [INF]*(2*self.N)
   
    def _evaluate(self,K):#Kの上の遅延配列を評価する
        H = K.bit_length() - 1
        for i in range(H,0,-1):
            h = K >> i
            if self.lazy[h] == INF:
                continue
            self.tree[h] = min(self.tree[h],self.lazy[h])
            self.lazy[h << 1] = min(self.lazy[h << 1],self.lazy[h])
            self.lazy[h << 1|1] = min(self.lazy[h << 1|1],self.lazy[h])
            self.lazy[h] = INF
    
    def _caluculate(self,K):#Kより上を計算する
        while K > 1:
            K >>= 1
            self.tree[K] = min(self.tree[K],self.tree[K<<1],self.lazy[K<<1],self.tree[K<<1|1],self.lazy[K<<1|1])

    def range_update(self,L,R,M):#[L,R)にMを作用
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        #self._evaluate(L0)
        #self._evaluate(R0)
        while L < R:
            if L&1:
                self.lazy[L] = min(self.lazy[L],M)
                L += 1
            if R&1:
                R -= 1
                self.lazy[R] = min(self.lazy[R],M)
            L >>= 1
            R >>= 1
        #print("L0 R0 {} {}\n".format(L0,R0))
        self._caluculate(L0)
        self._caluculate(R0)
    
    def range_query(self,L,R):#[L,R)を計算する
        L += self.N
        R += self.N
        L0 = L//(L & -L)
        R0 = R//(R & -R) - 1
        self._evaluate(L0)
        self._evaluate(R0)
        v = INF
        while L < R:
            if L&1:
                v = min(v,self.tree[L],self.lazy[L])
                L += 1
            if R&1:
                R -= 1
                v = min(self.tree[R],self.lazy[R],v)
            L >>= 1
            R >>= 1
        return v
    '''
    def __str__(self):
        return '\n'.join(' '.join(str(v) for v in self.tree[1<<i:1<<(i + 1)]) for i in range((2*self.N).bit_length()))
    '''
    def debug(self):
        print(self.lazy)
        print(self.tree)
    
    def __str__(self):
        for i in range(self.N):
            self.tree[i] = min(self.tree[i],self.lazy[i])
            self.lazy[i << 1] = min(self.lazy[i << 1],self.lazy[i])
            self.lazy[i << 1|1] = min(self.lazy[i << 1|1],self.lazy[i])
            self.lazy[i] = INF
        for i in range(self.N,self.N*2):
            self.tree[i] = min(self.tree[i],self.lazy[i])
        return '\n'.join(map(str,[k if k < INF else -1 for k in self.tree[self.N:]]))


N,Q = map(int,input().split())
roadwork = [tuple(map(int,input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
st = LazySegmentTree(Q)

for s,t,x in roadwork:
    l = bisect_left(D,s - x)
    r = bisect_left(D,t - x)
    st.range_update(l,r,x)
print(str(st))