from bisect import bisect_left as bisect
N,Q = map(int,input().split())
event = [tuple(map(int,input().split())) for i in range(N)]
D = [int(input()) for i in range(Q)]

event.sort(key=lambda x:x[2])

ans = [-1]*Q
neg = [-1]*Q

for s,t,x in event:
    l = bisect(D,s-x)
    r = bisect(D,t-x)
    t = l
    while t < r:
        if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t]

for i in range(Q):
    print(ans[i]) from bisect import bisect_left as bisect N,Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q tuple(map(int,input().split())) for i in range(N) for i in range(N) i range(N) range N for i in range(N) tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split event = [tuple(map(int,input().split())) for i in range(N)] event [tuple(map(int,input().split())) for i 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)] event.sort(key=lambda x:x[2]) event.sort event 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 neg = [-1]*Q neg [-1]*Q [-1] -1 Q for s,t,x in event:
    l = bisect(D,s-x)
    r = bisect(D,t-x)
    t = l
    while t < r:
        if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t] s t x event l = bisect(D,s-x) l bisect(D,s-x) bisect D s-x s x r = bisect(D,t-x) r bisect(D,t-x) bisect D t-x t x t = l t l while t < r:
        if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t] t < r t r if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t] neg[t] == -1 neg[t] neg t -1 ans[t] = x ans[t] ans t x neg[t] = r neg[t] neg t r t += 1 t 1 t = neg[t] t neg[t] neg t for i in range(Q):
    print(ans[i]) i range(Q) range Q print(ans[i]) print ans[i] ans i N,Q = map(int,input().split()) map(int,input().split()) N l = bisect(D,s-x) bisect(D,s-x) l t += 1 1 t neg = [-1]*Q [-1]*Q neg t = l l t t = neg[t] neg[t] t ans = [-1]*Q [-1]*Q ans Q = map(int,input().split()) map(int,input().split()) Q D = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] D r = bisect(D,t-x) bisect(D,t-x) r event = [tuple(map(int,input().split())) for i in range(N)] [tuple(map(int,input().split())) for i in range(N)] event
from bisect import bisect_left as bisect
N,Q = map(int,input().split())
event = [tuple(map(int,input().split())) for i in range(N)]
D = [int(input()) for i in range(Q)]

event.sort(key=lambda x:x[2])

ans = [-1]*Q
neg = [-1]*Q

for s,t,x in event:
    l = bisect(D,s-x)
    r = bisect(D,t-x)
    t = l
    while t < r:
        if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t]

for i in range(Q):
    print(ans[i])