# roadwork
import heapq
N, Q = map(int, input().split())
que = []
ans = [-1 for i in range(Q)]
D = [0 for i in range(N)]
heap = []
heapq.heapify(heap)
Set = set([])
for i in range(N):
    s, t, x = map(int, input().split())
    que.append((s-x, 0, i))  # append
    que.append((t-x, 1, i))  # remove
    D[i] = x

for i in range(Q):
    d = int(input())
    que.append((d, 2, i))  # querie

que.sort(key=lambda x: x[0])

for x in que:
    demand = x[1]
    if demand == 0:
        # append
        heapq.heappush(heap, (D[x[2]], x[2]))
        Set.add(x[2])
    elif demand == 1:
        # remove
        Set.remove(x[2])
    else:
        # querie
        flag = True
        while heap and flag:
            distance, index = heapq.heappop(heap)
            if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False
for i in range(Q):
    print(ans[i]) import heapq heapq N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q que = [] que [] -1 for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) -1 ans = [-1 for i in range(Q)] ans [-1 for i in range(Q)] 0 for i in range(N) for i in range(N) i range(N) range N for i in range(N) 0 D = [0 for i in range(N)] D [0 for i in range(N)] heap = [] heap [] heapq.heapify(heap) heapq.heapify heapq heapify heap Set = set([]) Set set([]) set [] for i in range(N):
    s, t, x = map(int, input().split())
    que.append((s-x, 0, i))  # append
    que.append((t-x, 1, i))  # remove
    D[i] = 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 que.append((s-x, 0, i)) que.append que append (s-x, 0, i) s-x s x 0 i que.append((t-x, 1, i)) que.append que append (t-x, 1, i) t-x t x 1 i D[i] = x D[i] D i x for i in range(Q):
    d = int(input())
    que.append((d, 2, i))  # querie i range(Q) range Q d = int(input()) d int(input()) int input() input que.append((d, 2, i)) que.append que append (d, 2, i) d 2 i que.sort(key=lambda x: x[0]) que.sort que sort key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x for x in que:
    demand = x[1]
    if demand == 0:
        # append
        heapq.heappush(heap, (D[x[2]], x[2]))
        Set.add(x[2])
    elif demand == 1:
        # remove
        Set.remove(x[2])
    else:
        # querie
        flag = True
        while heap and flag:
            distance, index = heapq.heappop(heap)
            if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False x que demand = x[1] demand x[1] x 1 if demand == 0:
        # append
        heapq.heappush(heap, (D[x[2]], x[2]))
        Set.add(x[2])
    elif demand == 1:
        # remove
        Set.remove(x[2])
    else:
        # querie
        flag = True
        while heap and flag:
            distance, index = heapq.heappop(heap)
            if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False demand == 0 demand 0 heapq.heappush(heap, (D[x[2]], x[2])) heapq.heappush heapq heappush heap (D[x[2]], x[2]) D[x[2]] D x[2] x 2 x[2] x 2 Set.add(x[2]) Set.add Set add x[2] x 2 elif demand == 1:
        # remove
        Set.remove(x[2])
     demand == 1 demand 1 Set.remove(x[2]) Set.remove Set remove x[2] x 2 flag = True flag True while heap and flag:
            distance, index = heapq.heappop(heap)
            if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False heap and flag heap flag distance, index = heapq.heappop(heap) distance heapq.heappop(heap) heapq.heappop heapq heappop heap index if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False index in Set index Set ans[x[2]] = distance ans[x[2]] ans x[2] x 2 distance heapq.heappush(heap, (distance, index)) heapq.heappush heapq heappush heap (distance, index) distance index flag = False flag False for i in range(Q):
    print(ans[i]) i range(Q) range Q print(ans[i]) print ans[i] ans i Set = set([]) set([]) Set heap = [] [] heap ans = [-1 for i in range(Q)] [-1 for i in range(Q)] ans flag = False False flag distance, index = heapq.heappop(heap) heapq.heappop(heap) distance d = int(input()) int(input()) d D = [0 for i in range(N)] [0 for i in range(N)] D t, x = map(int, input().split()) map(int, input().split()) t Q = map(int, input().split()) map(int, input().split()) Q index = heapq.heappop(heap) heapq.heappop(heap) index flag = True True flag que = [] [] que s, t, x = map(int, input().split()) map(int, input().split()) s N, Q = map(int, input().split()) map(int, input().split()) N x = map(int, input().split()) map(int, input().split()) x demand = x[1] x[1] demand
# roadwork
import heapq
N, Q = map(int, input().split())
que = []
ans = [-1 for i in range(Q)]
D = [0 for i in range(N)]
heap = []
heapq.heapify(heap)
Set = set([])
for i in range(N):
    s, t, x = map(int, input().split())
    que.append((s-x, 0, i))  # append
    que.append((t-x, 1, i))  # remove
    D[i] = x

for i in range(Q):
    d = int(input())
    que.append((d, 2, i))  # querie

que.sort(key=lambda x: x[0])

for x in que:
    demand = x[1]
    if demand == 0:
        # append
        heapq.heappush(heap, (D[x[2]], x[2]))
        Set.add(x[2])
    elif demand == 1:
        # remove
        Set.remove(x[2])
    else:
        # querie
        flag = True
        while heap and flag:
            distance, index = heapq.heappop(heap)
            if index in Set:
                ans[x[2]] = distance
                heapq.heappush(heap, (distance, index))
                flag = False
for i in range(Q):
    print(ans[i])