import heapq
from collections import deque
N, Q = map( int, input().split())
H = [(0,0,0) for _ in range(N)]
for i in range(N):
    s, t, x = map( int, input().split())
    H[i] = (x-t+1, x-s, x)
D = [ ( -int( input()), i) for i in range(Q)]
D.sort()
H.sort()
d = deque(H)
q = []
ANS = [0]*Q
for i in range(Q):
    t, j = D[i]
    while d:
        if d[0][0] <= t:
            _, s, x = d.popleft()
            heapq.heappush(q,(x,s))
        else:
            break
    while q:
        if q[0][1] >= t:
            break
        heapq.heappop(q)
    if not q:
        ANS[j] = -1
    else:
        ANS[j] = q[0][0]
for ans in ANS:
    print( ans) import heapq heapq from collections import deque N, Q = map( int, input().split()) N map( int, input().split()) map int input().split() ().split () input split Q (0,0,0) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) (0,0,0) 0 0 0 H = [(0,0,0) for _ in range(N)] H [(0,0,0) for _ in range(N)] for i in range(N):
    s, t, x = map( int, input().split())
    H[i] = (x-t+1, x-s, x) i range(N) range N s, t, x = map( int, input().split()) s map( int, input().split()) map int input().split() ().split () input split t x H[i] = (x-t+1, x-s, x) H[i] H i (x-t+1, x-s, x) x-t+1 x-t x t 1 x-s x s x ( -int( input()), i) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) ( -int( input()), i) -int( input()) int( input()) int input() input i D = [ ( -int( input()), i) for i in range(Q)] D [ ( -int( input()), i) for i in range(Q)] D.sort() D.sort D sort H.sort() H.sort H sort d = deque(H) d deque(H) deque H q = [] q [] ANS = [0]*Q ANS [0]*Q [0] 0 Q for i in range(Q):
    t, j = D[i]
    while d:
        if d[0][0] <= t:
            _, s, x = d.popleft()
            heapq.heappush(q,(x,s))
        else:
            break
    while q:
        if q[0][1] >= t:
            break
        heapq.heappop(q)
    if not q:
        ANS[j] = -1
    else:
        ANS[j] = q[0][0] i range(Q) range Q t, j = D[i] t D[i] D i j while d:
        if d[0][0] <= t:
            _, s, x = d.popleft()
            heapq.heappush(q,(x,s))
        else:
            break
     d if d[0][0] <= t:
            _, s, x = d.popleft()
            heapq.heappush(q,(x,s))
        else:
            break
     d[0][0] <= t d[0][0] [0] d 0 0 t _, s, x = d.popleft() _ d.popleft() d.popleft d popleft s x heapq.heappush(q,(x,s)) heapq.heappush heapq heappush q (x,s) x s break while q:
        if q[0][1] >= t:
            break
        heapq.heappop(q)
     q if q[0][1] >= t:
            break
         q[0][1] >= t q[0][1] [0] q 0 1 t break heapq.heappop(q) heapq.heappop heapq heappop q if not q:
        ANS[j] = -1
    else:
        ANS[j] = q[0][0] not q q ANS[j] = -1 ANS[j] ANS j -1 ANS[j] = q[0][0] ANS[j] ANS j q[0][0] [0] q 0 0 for ans in ANS:
    print( ans) ans ANS print( ans) print ans D = [ ( -int( input()), i) for i in range(Q)] [ ( -int( input()), i) for i in range(Q)] D s, x = d.popleft() d.popleft() s N, Q = map( int, input().split()) map( int, input().split()) N x = map( int, input().split()) map( int, input().split()) x t, j = D[i] D[i] t _, s, x = d.popleft() d.popleft() _ d = deque(H) deque(H) d t, x = map( int, input().split()) map( int, input().split()) t j = D[i] D[i] j x = d.popleft() d.popleft() x Q = map( int, input().split()) map( int, input().split()) Q ANS = [0]*Q [0]*Q ANS H = [(0,0,0) for _ in range(N)] [(0,0,0) for _ in range(N)] H q = [] [] q s, t, x = map( int, input().split()) map( int, input().split()) s
import heapq
from collections import deque
N, Q = map( int, input().split())
H = [(0,0,0) for _ in range(N)]
for i in range(N):
    s, t, x = map( int, input().split())
    H[i] = (x-t+1, x-s, x)
D = [ ( -int( input()), i) for i in range(Q)]
D.sort()
H.sort()
d = deque(H)
q = []
ANS = [0]*Q
for i in range(Q):
    t, j = D[i]
    while d:
        if d[0][0] <= t:
            _, s, x = d.popleft()
            heapq.heappush(q,(x,s))
        else:
            break
    while q:
        if q[0][1] >= t:
            break
        heapq.heappop(q)
    if not q:
        ANS[j] = -1
    else:
        ANS[j] = q[0][0]
for ans in ANS:
    print( ans)
