import heapq
n, q = map(int, input().split())
event = []
for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x))

event.sort()
heap = []
xs = set([])

d = [int(input()) for _ in range(q)] + [10**9 + 7]
ans = [-1] * q
index = 0
for t, query, x in event:
    while d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
        index += 1

    if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        xs.remove(x)


while index < q:
    while heap:
        tmp = heapq.heappop(heap)
        if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
    index += 1

print("\n".join(map(str, ans)))


 import heapq heapq n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q event = [] event [] for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x)) _ 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 event.append((s-x, 1, x)) event.append event append (s-x, 1, x) s-x s x 1 x event.append((t-x, -1, x)) event.append event append (t-x, -1, x) t-x t x -1 x event.sort() event.sort event sort heap = [] heap [] xs = set([]) xs set([]) set [] int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input d = [int(input()) for _ in range(q)] + [10**9 + 7] d [int(input()) for _ in range(q)] + [10**9 + 7] [int(input()) for _ in range(q)] [10**9 + 7] 10**9 + 7 10**9 10 9 7 ans = [-1] * q ans [-1] * q [-1] -1 q index = 0 index 0 for t, query, x in event:
    while d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
        index += 1

    if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        xs.remove(x) t query x event while d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
        index += 1

     d[index] < t d[index] d index t if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
         not xs xs while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
         heap tmp = heapq.heappop(heap) tmp heapq.heappop(heap) heapq.heappop heapq heappop heap if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
         tmp in xs tmp xs heapq.heappush(heap, tmp) heapq.heappush heapq heappush heap tmp ans[index] = tmp ans[index] ans index tmp break index += 1 index 1 if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        xs.remove(x) query == 1 query 1 xs.add(x) xs.add xs add x heapq.heappush(heap, x) heapq.heappush heapq heappush heap x xs.remove(x) xs.remove xs remove x while index < q:
    while heap:
        tmp = heapq.heappop(heap)
        if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
    index += 1 index < q index q while heap:
        tmp = heapq.heappop(heap)
        if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
     heap tmp = heapq.heappop(heap) tmp heapq.heappop(heap) heapq.heappop heapq heappop heap if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
     tmp in xs tmp xs heapq.heappush(heap, tmp) heapq.heappush heapq heappush heap tmp ans[index] = tmp ans[index] ans index tmp break index += 1 index 1 print("\n".join(map(str, ans))) print "\n".join(map(str, ans)) "\n".join "\n" join map(str, ans) map str ans heap = [] [] heap s, t, x = map(int, input().split()) map(int, input().split()) s q = map(int, input().split()) map(int, input().split()) q index += 1 1 index tmp = heapq.heappop(heap) heapq.heappop(heap) tmp n, q = map(int, input().split()) map(int, input().split()) n tmp = heapq.heappop(heap) heapq.heappop(heap) tmp ans = [-1] * q [-1] * q ans xs = set([]) set([]) xs index = 0 0 index d = [int(input()) for _ in range(q)] + [10**9 + 7] [int(input()) for _ in range(q)] + [10**9 + 7] d t, x = map(int, input().split()) map(int, input().split()) t event = [] [] event index += 1 1 index x = map(int, input().split()) map(int, input().split()) x
import heapq
n, q = map(int, input().split())
event = []
for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x))

event.sort()
heap = []
xs = set([])

d = [int(input()) for _ in range(q)] + [10**9 + 7]
ans = [-1] * q
index = 0
for t, query, x in event:
    while d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
        index += 1

    if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        xs.remove(x)


while index < q:
    while heap:
        tmp = heapq.heappop(heap)
        if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
    index += 1

print("\n".join(map(str, ans)))



