from bisect import bisect_left

def main():
    ConstNum,PersonNum=map(int,input().split())

    S=[]
    T=[]
    X=[]
    for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

    DepartureTime=[]
    for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

    XST=zip(X,S,T)
    XST=sorted(XST)

    res=[-1]*PersonNum
    stop=[-1]*PersonNum

    for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

    for i in range(PersonNum):
        print(res[i])

if __name__=="__main__":
    main() from bisect import bisect_left def main():
    ConstNum,PersonNum=map(int,input().split())

    S=[]
    T=[]
    X=[]
    for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

    DepartureTime=[]
    for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

    XST=zip(X,S,T)
    XST=sorted(XST)

    res=[-1]*PersonNum
    stop=[-1]*PersonNum

    for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

    for i in range(PersonNum):
        print(res[i]) main ConstNum,PersonNum=map(int,input().split()) ConstNum map(int,input().split()) map int input().split() ().split () input split PersonNum S=[] S [] T=[] T [] X=[] X [] for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

     i range(ConstNum) range ConstNum s,t,x=map(int,input().split()) s map(int,input().split()) map int input().split() ().split () input split t x S.append(s) S.append S append s T.append(t) T.append T append t X.append(x) X.append X append x DepartureTime=[] DepartureTime [] for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

     i range(PersonNum) range PersonNum d=int(input()) d int(input()) int input() input DepartureTime.append(d) DepartureTime.append DepartureTime append d XST=zip(X,S,T) XST zip(X,S,T) zip X S T XST=sorted(XST) XST sorted(XST) sorted XST res=[-1]*PersonNum res [-1]*PersonNum [-1] -1 PersonNum stop=[-1]*PersonNum stop [-1]*PersonNum [-1] -1 PersonNum for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

     x s t XST left_value=s-x left_value s-x s x right_value=t-x right_value t-x t x left_index=bisect_left(DepartureTime,left_value) left_index bisect_left(DepartureTime,left_value) bisect_left DepartureTime left_value right_index=bisect_left(DepartureTime,right_value) right_index bisect_left(DepartureTime,right_value) bisect_left DepartureTime right_value while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

     left_index<right_index left_index right_index if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

     stop[left_index]==-1 stop[left_index] stop left_index -1 res[left_index]=x res[left_index] res left_index x stop[left_index]=right_index stop[left_index] stop left_index right_index left_index+=1 left_index 1 left_index=stop[left_index] left_index stop[left_index] stop left_index for i in range(PersonNum):
        print(res[i]) i range(PersonNum) range PersonNum print(res[i]) print res[i] res i if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def main():
    ConstNum,PersonNum=map(int,input().split())

    S=[]
    T=[]
    X=[]
    for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

    DepartureTime=[]
    for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

    XST=zip(X,S,T)
    XST=sorted(XST)

    res=[-1]*PersonNum
    stop=[-1]*PersonNum

    for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

    for i in range(PersonNum):
        print(res[i]) def main():
    ConstNum,PersonNum=map(int,input().split())

    S=[]
    T=[]
    X=[]
    for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

    DepartureTime=[]
    for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

    XST=zip(X,S,T)
    XST=sorted(XST)

    res=[-1]*PersonNum
    stop=[-1]*PersonNum

    for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

    for i in range(PersonNum):
        print(res[i]) main
from bisect import bisect_left

def main():
    ConstNum,PersonNum=map(int,input().split())

    S=[]
    T=[]
    X=[]
    for i in range(ConstNum):
        s,t,x=map(int,input().split())
        S.append(s)
        T.append(t)
        X.append(x)

    DepartureTime=[]
    for i in range(PersonNum):
        d=int(input())
        DepartureTime.append(d)

    XST=zip(X,S,T)
    XST=sorted(XST)

    res=[-1]*PersonNum
    stop=[-1]*PersonNum

    for x,s,t in XST:
        left_value=s-x
        right_value=t-x

        left_index=bisect_left(DepartureTime,left_value)
        right_index=bisect_left(DepartureTime,right_value)

        while left_index<right_index:
            if stop[left_index]==-1:
                res[left_index]=x
                stop[left_index]=right_index
                left_index+=1
            else:
                left_index=stop[left_index]

    for i in range(PersonNum):
        print(res[i])

if __name__=="__main__":
    main()