if __name__ == '__main__':
    import sys
    input=sys.stdin.readline
    N,Q=list(map(int,input().split()))
    events=[list(map(int,input().split())) for _ in range(N)]
    D=[int(input()) for i in range(Q)]
    ans=["-1"]*Q
    skip=[-1]*Q
    events.sort(key=lambda x:x[2])
    import bisect
    for S,T,X in events:
        right=bisect.bisect_left(D,T-X)
        left=bisect.bisect_left(D,S-X)
        while left<right:
            if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
    print("\n".join(ans)) if __name__ == '__main__':
    import sys
    input=sys.stdin.readline
    N,Q=list(map(int,input().split()))
    events=[list(map(int,input().split())) for _ in range(N)]
    D=[int(input()) for i in range(Q)]
    ans=["-1"]*Q
    skip=[-1]*Q
    events.sort(key=lambda x:x[2])
    import bisect
    for S,T,X in events:
        right=bisect.bisect_left(D,T-X)
        left=bisect.bisect_left(D,S-X)
        while left<right:
            if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
    print("\n".join(ans)) __name__ == '__main__' __name__ '__main__' import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N,Q=list(map(int,input().split())) N list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split Q list(map(int,input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split events=[list(map(int,input().split())) for _ in range(N)] events [list(map(int,input().split())) for _ in range(N)] int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input D=[int(input()) for i in range(Q)] D [int(input()) for i in range(Q)] ans=["-1"]*Q ans ["-1"]*Q ["-1"] "-1" Q skip=[-1]*Q skip [-1]*Q [-1] -1 Q events.sort(key=lambda x:x[2]) events.sort events sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x import bisect bisect for S,T,X in events:
        right=bisect.bisect_left(D,T-X)
        left=bisect.bisect_left(D,S-X)
        while left<right:
            if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
     S T X events right=bisect.bisect_left(D,T-X) right bisect.bisect_left(D,T-X) bisect.bisect_left bisect bisect_left D T-X T X left=bisect.bisect_left(D,S-X) left bisect.bisect_left(D,S-X) bisect.bisect_left bisect bisect_left D S-X S X while left<right:
            if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
     left<right left right if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
     skip[left]==-1 skip[left] skip left -1 ans[left]=str(X) ans[left] ans left str(X) str X skip[left]=right skip[left] skip left right left+=1 left 1 left=skip[left] left skip[left] skip left print("\n".join(ans)) print "\n".join(ans) "\n".join "\n" join ans N,Q=list(map(int,input().split())) list(map(int,input().split())) N left=bisect.bisect_left(D,S-X) bisect.bisect_left(D,S-X) left left=skip[left] skip[left] left input=sys.stdin.readline sys.stdin.readline input Q=list(map(int,input().split())) list(map(int,input().split())) Q skip=[-1]*Q [-1]*Q skip ans=["-1"]*Q ["-1"]*Q ans left+=1 1 left D=[int(input()) for i in range(Q)] [int(input()) for i in range(Q)] D events=[list(map(int,input().split())) for _ in range(N)] [list(map(int,input().split())) for _ in range(N)] events right=bisect.bisect_left(D,T-X) bisect.bisect_left(D,T-X) right
if __name__ == '__main__':
    import sys
    input=sys.stdin.readline
    N,Q=list(map(int,input().split()))
    events=[list(map(int,input().split())) for _ in range(N)]
    D=[int(input()) for i in range(Q)]
    ans=["-1"]*Q
    skip=[-1]*Q
    events.sort(key=lambda x:x[2])
    import bisect
    for S,T,X in events:
        right=bisect.bisect_left(D,T-X)
        left=bisect.bisect_left(D,S-X)
        while left<right:
            if skip[left]==-1:
                ans[left]=str(X)
                skip[left]=right
                left+=1
            else:
                left=skip[left]
    print("\n".join(ans))
