def main():
    class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
    from sys import stdin
    input=stdin.readline
    import bisect

    n,q=map(int,input().split())
    stx=[list(map(int,input().split())) for _ in [0]*n]
    d=[int(input()) for _ in [0]*q]
    stx=[[s-x,t-x-1,x] for s,t,x in stx]
    stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx]
    seg=segtree(q)
    for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
    seg.range_update()
    ans=[i for i in seg.tree[seg.treesize-seg.basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i)
main() def main():
    class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
    from sys import stdin
    input=stdin.readline
    import bisect

    n,q=map(int,input().split())
    stx=[list(map(int,input().split())) for _ in [0]*n]
    d=[int(input()) for _ in [0]*q]
    stx=[[s-x,t-x-1,x] for s,t,x in stx]
    stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx]
    seg=segtree(q)
    for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
    seg.range_update()
    ans=[i for i in seg.tree[seg.treesize-seg.basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) main class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
     segtree def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
         __init__ self.ini=10**9+1 self.ini self ini 10**9+1 10**9 10 9 1 self.basesize=basesize self.basesize self basesize basesize self.num,self.depth=1,1 self.num self num 1 self.depth self depth 1 while self.num<self.basesize:
                self.num*=2
                self.depth+=1
             self.num<self.basesize self.num self num self.basesize self basesize self.num*=2 self.num self num 2 self.depth+=1 self.depth self depth 1 self.num-=1 self.num self num 1 self.monoid=min self.monoid self monoid min self.treesize=self.num+self.basesize self.treesize self treesize self.num+self.basesize self.num self num self.basesize self basesize self.tree=[self.ini]*self.treesize self.tree self tree [self.ini]*self.treesize [self.ini] self.ini self ini self.treesize self treesize self self basesize basesize def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
         range_update_pre q=[[0,1]] q [[0,1]] [0,1] 0 1 while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
         q i,f=q.pop() i q.pop() q.pop q pop f width=pow(2,self.depth-f) width pow(2,self.depth-f) pow 2 self.depth-f self.depth self depth f kagen=(i-pow(2,f-1)+1)*width kagen (i-pow(2,f-1)+1)*width i-pow(2,f-1)+1 i-pow(2,f-1) i pow(2,f-1) pow 2 f-1 f 1 1 width chuo=kagen+width//2 chuo kagen+width//2 kagen width//2 width 2 jogen=kagen+width jogen kagen+width kagen width k=2*i+1 k 2*i+1 2*i 2 i 1 if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                 lower<=kagen and jogen<=upper lower<=kagen lower kagen jogen<=upper jogen upper self.tree[i]=self.monoid(new_value,self.tree[i]) self.tree[i] self.tree self tree i self.monoid(new_value,self.tree[i]) self.monoid self monoid new_value self.tree[i] self.tree self tree i continue if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                 k<self.treesize k self.treesize self treesize if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                 lower<=kagen and chuo<=upper lower<=kagen lower kagen chuo<=upper chuo upper elif lower<=chuo:q.append([k,f+1])
                 lower<=chuo lower chuo if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
         k+1<self.treesize k+1 k 1 self.treesize self treesize if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
         lower<=chuo and jogen<=upper lower<=chuo lower chuo jogen<=upper jogen upper elif chuo<=upper:q.append([k+1,f+1])

        #更新
         chuo<=upper chuo upper self self lower lower upper upper new_value new_value def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
     range_update for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
     i range(1,self.treesize) range 1 self.treesize self treesize self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2]) self.tree[i] self.tree self tree i self.monoid(self.tree[i],self.tree[(i-1)//2]) self.monoid self monoid self.tree[i] self.tree self tree i self.tree[(i-1)//2] self.tree self tree (i-1)//2 i-1 i 1 2 self self from sys import stdin input=stdin.readline input stdin.readline stdin readline import bisect bisect n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q list(map(int,input().split())) for _ in [0]*n for _ in [0]*n _ [0]*n [0] 0 n for _ in [0]*n list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split stx=[list(map(int,input().split())) for _ in [0]*n] stx [list(map(int,input().split())) for _ in [0]*n] int(input()) for _ in [0]*q for _ in [0]*q _ [0]*q [0] 0 q for _ in [0]*q int(input()) int input() input d=[int(input()) for _ in [0]*q] d [int(input()) for _ in [0]*q] [s-x,t-x-1,x] for s,t,x in stx for s,t,x in stx s t x stx for s,t,x in stx [s-x,t-x-1,x] s-x s x t-x-1 t-x t x 1 x stx=[[s-x,t-x-1,x] for s,t,x in stx] stx [[s-x,t-x-1,x] for s,t,x in stx] [bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx for s,t,x in stx s t x stx for s,t,x in stx [bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] bisect.bisect_left(d,s) bisect.bisect_left bisect bisect_left d s bisect.bisect_right(d,t) bisect.bisect_right bisect bisect_right d t x stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx] stx [[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx] seg=segtree(q) seg segtree(q) segtree q for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
     s t x stx if s<t:
            seg.range_update_pre(s,t,x)
     s<t s t seg.range_update_pre(s,t,x) seg.range_update_pre seg range_update_pre s t x seg.range_update() seg.range_update seg range_update i for i in seg.tree[seg.treesize-seg.basesize:] for i in seg.tree[seg.treesize-seg.basesize:] i seg.tree[seg.treesize-seg.basesize:] seg.tree seg tree seg.treesize-seg.basesize: seg.treesize-seg.basesize seg.treesize seg treesize seg.basesize seg basesize for i in seg.tree[seg.treesize-seg.basesize:] i ans=[i for i in seg.tree[seg.treesize-seg.basesize:]] ans [i for i in seg.tree[seg.treesize-seg.basesize:]] for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) i ans if i==10**9+1:
            print(-1)
        else:
            print(i) i==10**9+1 i 10**9+1 10**9 10 9 1 print(-1) print -1 print(i) print i main() main def main():
    class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
    from sys import stdin
    input=stdin.readline
    import bisect

    n,q=map(int,input().split())
    stx=[list(map(int,input().split())) for _ in [0]*n]
    d=[int(input()) for _ in [0]*q]
    stx=[[s-x,t-x-1,x] for s,t,x in stx]
    stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx]
    seg=segtree(q)
    for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
    seg.range_update()
    ans=[i for i in seg.tree[seg.treesize-seg.basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) def main():
    class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
    from sys import stdin
    input=stdin.readline
    import bisect

    n,q=map(int,input().split())
    stx=[list(map(int,input().split())) for _ in [0]*n]
    d=[int(input()) for _ in [0]*q]
    stx=[[s-x,t-x-1,x] for s,t,x in stx]
    stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx]
    seg=segtree(q)
    for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
    seg.range_update()
    ans=[i for i in seg.tree[seg.treesize-seg.basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) main
def main():
    class segtree():
        def __init__(self,basesize):#self,モノイド,元の配列
            #ini：上限（下限）,base：元の配列,monoid：モノイド,tree：セグ木,depth：treeの深さ,
            #basesize：baseの要素数,treesize：treeの要素数,num：treesize-basesize
            
            # 初期値（上限とか下限）を決定
            self.ini=10**9+1
            #セグ木の要素数（num）および深さ（depth）を計算
            self.basesize=basesize
            self.num,self.depth=1,1
            while self.num<self.basesize:
                self.num*=2
                self.depth+=1
            self.num-=1
            #関数（モノイド、今回はmin）を設定
            self.monoid=min
            #セグ木を構築
            self.treesize=self.num+self.basesize
            self.tree=[self.ini]*self.treesize
    
        #半開区間[lower,upper)について更新の準備をする関数（テスト中、minやmaxのときのみ）
        def range_update_pre(self,lower,upper,new_value):
            q=[[0,1]]  #インデックス、階層
            while q:
                i,f=q.pop()
                #popしたインデックスと階層から、求める下限と上限を算出する
                #幅
                width=pow(2,self.depth-f)
                #下限と中央と上限
                kagen=(i-pow(2,f-1)+1)*width
                chuo=kagen+width//2
                jogen=kagen+width
                k=2*i+1
                if lower<=kagen and jogen<=upper:
                    self.tree[i]=self.monoid(new_value,self.tree[i])
                    continue
                if k<self.treesize:
                    if lower<=kagen and chuo<=upper:self.tree[k]=self.monoid(new_value,self.tree[k])
                    elif lower<=chuo:q.append([k,f+1])
                if k+1<self.treesize:
                    if lower<=chuo and jogen<=upper:self.tree[k+1]=self.monoid(new_value,self.tree[k+1])
                    elif chuo<=upper:q.append([k+1,f+1])

        #更新
        def range_update(self):
            for i in range(1,self.treesize):
                self.tree[i]=self.monoid(self.tree[i],self.tree[(i-1)//2])
    from sys import stdin
    input=stdin.readline
    import bisect

    n,q=map(int,input().split())
    stx=[list(map(int,input().split())) for _ in [0]*n]
    d=[int(input()) for _ in [0]*q]
    stx=[[s-x,t-x-1,x] for s,t,x in stx]
    stx=[[bisect.bisect_left(d,s),bisect.bisect_right(d,t),x] for s,t,x in stx]
    seg=segtree(q)
    for s,t,x in stx:
        if s<t:
            seg.range_update_pre(s,t,x)
    seg.range_update()
    ans=[i for i in seg.tree[seg.treesize-seg.basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i)
main()