import bisect
import sys
input=sys.stdin.readline
N,Q=map(int,input().split())
STX=[list(map(int,input().split())) for i in range(N)]
STX.sort(key=lambda x:x[2])
ans=[-1]*Q
jump=[-1]*Q
D=[int(input()) for i in range(Q)]
for s,t,x in STX:
    l=bisect.bisect_left(D,s-x)
    r=bisect.bisect_left(D,t-x)
    while(l<r):
        k=jump[l]
        if k==-1:
            ans[l]=x
            jump[l]=r
            l+=1
        else:
            l=k
for i in range(Q):
    print(ans[i]) import bisect bisect import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys 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 i in range(N) for i in range(N) i range(N) range N for i in range(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 i in range(N)] STX [list(map(int,input().split())) for i in range(N)] STX.sort(key=lambda x:x[2]) STX.sort STX sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x ans=[-1]*Q ans [-1]*Q [-1] -1 Q jump=[-1]*Q jump [-1]*Q [-1] -1 Q 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)] for s,t,x in STX:
    l=bisect.bisect_left(D,s-x)
    r=bisect.bisect_left(D,t-x)
    while(l<r):
        k=jump[l]
        if k==-1:
            ans[l]=x
            jump[l]=r
            l+=1
        else:
            l=k s t x STX l=bisect.bisect_left(D,s-x) l bisect.bisect_left(D,s-x) bisect.bisect_left bisect bisect_left D s-x s x r=bisect.bisect_left(D,t-x) r bisect.bisect_left(D,t-x) bisect.bisect_left bisect bisect_left D t-x t x while(l<r):
        k=jump[l]
        if k==-1:
            ans[l]=x
            jump[l]=r
            l+=1
        else:
            l=k l<r l r k=jump[l] k jump[l] jump l if k==-1:
            ans[l]=x
            jump[l]=r
            l+=1
        else:
            l=k k==-1 k -1 ans[l]=x ans[l] ans l x jump[l]=r jump[l] jump l r l+=1 l 1 l=k l k for i in range(Q):
    print(ans[i]) i range(Q) range Q print(ans[i]) print ans[i] ans i Q=map(int,input().split()) map(int,input().split()) Q r=bisect.bisect_left(D,t-x) bisect.bisect_left(D,t-x) r ans=[-1]*Q [-1]*Q ans STX=[list(map(int,input().split())) for i in range(N)] [list(map(int,input().split())) for i in range(N)] STX l=bisect.bisect_left(D,s-x) bisect.bisect_left(D,s-x) l N,Q=map(int,input().split()) map(int,input().split()) N jump=[-1]*Q [-1]*Q jump D=[int(input()) for i in range(Q)] [int(input()) for i in range(Q)] D input=sys.stdin.readline sys.stdin.readline input l+=1 1 l k=jump[l] jump[l] k l=k k l
import bisect
import sys
input=sys.stdin.readline
N,Q=map(int,input().split())
STX=[list(map(int,input().split())) for i in range(N)]
STX.sort(key=lambda x:x[2])
ans=[-1]*Q
jump=[-1]*Q
D=[int(input()) for i in range(Q)]
for s,t,x in STX:
    l=bisect.bisect_left(D,s-x)
    r=bisect.bisect_left(D,t-x)
    while(l<r):
        k=jump[l]
        if k==-1:
            ans[l]=x
            jump[l]=r
            l+=1
        else:
            l=k
for i in range(Q):
    print(ans[i])
