def main():
    from bisect import bisect_left
    from bisect import bisect_right
    from sys import stdin
    input=stdin.readline

    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_left(d,s),bisect_right(d,t),x] for s,t,x in stx]

    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=q
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #セグ木を構築
    treesize=num+basesize
    tree=[10**9+1]*treesize
    
    #半開区間[lower,upper)について更新の準備をする関数
    def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

    for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

    for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

    ans=[i for i in tree[treesize-basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i)
main() def main():
    from bisect import bisect_left
    from bisect import bisect_right
    from sys import stdin
    input=stdin.readline

    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_left(d,s),bisect_right(d,t),x] for s,t,x in stx]

    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=q
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #セグ木を構築
    treesize=num+basesize
    tree=[10**9+1]*treesize
    
    #半開区間[lower,upper)について更新の準備をする関数
    def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

    for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

    for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

    ans=[i for i in tree[treesize-basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) main from bisect import bisect_left from bisect import bisect_right from sys import stdin input=stdin.readline input stdin.readline stdin readline 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_left(d,s),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_left(d,s),bisect_right(d,t),x] bisect_left(d,s) bisect_left d s bisect_right(d,t) bisect_right d t x stx=[[bisect_left(d,s),bisect_right(d,t),x] for s,t,x in stx] stx [[bisect_left(d,s),bisect_right(d,t),x] for s,t,x in stx] basesize=q basesize q num,depth=1,1 num 1 depth 1 while num<basesize:
        num*=2
        depth+=1
     num<basesize num basesize num*=2 num 2 depth+=1 depth 1 num-=1 num 1 treesize=num+basesize treesize num+basesize num basesize tree=[10**9+1]*treesize tree [10**9+1]*treesize [10**9+1] 10**9+1 10**9 10 9 1 treesize def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,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,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,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,depth-f) width pow(2,depth-f) pow 2 depth-f 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:
                tree[i]=min(new_value,tree[i])
                continue
             lower<=kagen and jogen<=upper lower<=kagen lower kagen jogen<=upper jogen upper tree[i]=min(new_value,tree[i]) tree[i] tree i min(new_value,tree[i]) min new_value tree[i] tree i continue if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
             k<treesize k treesize if lower<=kagen and chuo<=upper:tree[k]=min(new_value,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<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

     k+1<treesize k+1 k 1 treesize if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,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 lower lower upper upper new_value new_value for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

     s t x stx if s<t:
            range_update_pre(s,t,x)

     s<t s t range_update_pre(s,t,x) range_update_pre s t x for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

     i range(1,treesize) range 1 treesize tree[i]=min(tree[i],tree[(i-1)//2]) tree[i] tree i min(tree[i],tree[(i-1)//2]) min tree[i] tree i tree[(i-1)//2] tree (i-1)//2 i-1 i 1 2 i for i in tree[treesize-basesize:] for i in tree[treesize-basesize:] i tree[treesize-basesize:] tree treesize-basesize: treesize-basesize treesize basesize for i in tree[treesize-basesize:] i ans=[i for i in tree[treesize-basesize:]] ans [i for i in tree[treesize-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():
    from bisect import bisect_left
    from bisect import bisect_right
    from sys import stdin
    input=stdin.readline

    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_left(d,s),bisect_right(d,t),x] for s,t,x in stx]

    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=q
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #セグ木を構築
    treesize=num+basesize
    tree=[10**9+1]*treesize
    
    #半開区間[lower,upper)について更新の準備をする関数
    def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

    for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

    for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

    ans=[i for i in tree[treesize-basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) def main():
    from bisect import bisect_left
    from bisect import bisect_right
    from sys import stdin
    input=stdin.readline

    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_left(d,s),bisect_right(d,t),x] for s,t,x in stx]

    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=q
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #セグ木を構築
    treesize=num+basesize
    tree=[10**9+1]*treesize
    
    #半開区間[lower,upper)について更新の準備をする関数
    def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

    for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

    for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

    ans=[i for i in tree[treesize-basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i) main
def main():
    from bisect import bisect_left
    from bisect import bisect_right
    from sys import stdin
    input=stdin.readline

    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_left(d,s),bisect_right(d,t),x] for s,t,x in stx]

    #セグ木の要素数（num）および深さ（depth）を計算
    basesize=q
    num,depth=1,1
    while num<basesize:
        num*=2
        depth+=1
    num-=1
    #セグ木を構築
    treesize=num+basesize
    tree=[10**9+1]*treesize
    
    #半開区間[lower,upper)について更新の準備をする関数
    def range_update_pre(lower,upper,new_value):
        q=[[0,1]]  #インデックス、階層
        while q:
            i,f=q.pop()
            #popしたインデックスと階層から、求める下限と上限を算出する
            #幅
            width=pow(2,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:
                tree[i]=min(new_value,tree[i])
                continue
            if k<treesize:
                if lower<=kagen and chuo<=upper:tree[k]=min(new_value,tree[k])
                elif lower<=chuo:q.append([k,f+1])
            if k+1<treesize:
                if lower<=chuo and jogen<=upper:tree[k+1]=min(new_value,tree[k+1])
                elif chuo<=upper:q.append([k+1,f+1])

    for s,t,x in stx:
        if s<t:
            range_update_pre(s,t,x)

    for i in range(1,treesize):
        tree[i]=min(tree[i],tree[(i-1)//2])

    ans=[i for i in tree[treesize-basesize:]]
    for i in ans:
        if i==10**9+1:
            print(-1)
        else:
            print(i)
main()