import heapq

N, Q = map(int,input().split())

events = []

for _ in range(N):
    S, T, X = map(int,input().split())

    events.append([S-X, 1, X])
    events.append([T-X, 0, X])

for _ in range(Q):
    D = int(input())
    events.append([D,2,0])

events.sort()

closed = set()
que = []

idx = 0
for time, flag, position in events:
    if flag == 0:
        closed.remove(position)
    elif flag == 1:
        heapq.heappush(que, position)
        closed.add(position)
    else:
        while len(que) > 0 and que[0] not in closed:
            heapq.heappop(que)

        if len(que) > 0:
            print(que[0])
        else:
            print(-1) import heapq heapq N, Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q events = [] events [] for _ in range(N):
    S, T, X = map(int,input().split())

    events.append([S-X, 1, X])
    events.append([T-X, 0, 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 events.append([S-X, 1, X]) events.append events append [S-X, 1, X] S-X S X 1 X events.append([T-X, 0, X]) events.append events append [T-X, 0, X] T-X T X 0 X for _ in range(Q):
    D = int(input())
    events.append([D,2,0]) _ range(Q) range Q D = int(input()) D int(input()) int input() input events.append([D,2,0]) events.append events append [D,2,0] D 2 0 events.sort() events.sort events sort closed = set() closed set() set que = [] que [] idx = 0 idx 0 for time, flag, position in events:
    if flag == 0:
        closed.remove(position)
    elif flag == 1:
        heapq.heappush(que, position)
        closed.add(position)
    else:
        while len(que) > 0 and que[0] not in closed:
            heapq.heappop(que)

        if len(que) > 0:
            print(que[0])
        else:
            print(-1) time flag position events if flag == 0:
        closed.remove(position)
    elif flag == 1:
        heapq.heappush(que, position)
        closed.add(position)
    else:
        while len(que) > 0 and que[0] not in closed:
            heapq.heappop(que)

        if len(que) > 0:
            print(que[0])
        else:
            print(-1) flag == 0 flag 0 closed.remove(position) closed.remove closed remove position elif flag == 1:
        heapq.heappush(que, position)
        closed.add(position)
     flag == 1 flag 1 heapq.heappush(que, position) heapq.heappush heapq heappush que position closed.add(position) closed.add closed add position while len(que) > 0 and que[0] not in closed:
            heapq.heappop(que)

         len(que) > 0 and que[0] not in closed len(que) > 0 len(que) len que 0 que[0] not in closed que[0] que 0 closed heapq.heappop(que) heapq.heappop heapq heappop que if len(que) > 0:
            print(que[0])
        else:
            print(-1) len(que) > 0 len(que) len que 0 print(que[0]) print que[0] que 0 print(-1) print -1 T, X = map(int,input().split()) map(int,input().split()) T closed = set() set() closed idx = 0 0 idx D = int(input()) int(input()) D que = [] [] que events = [] [] events X = map(int,input().split()) map(int,input().split()) X N, Q = map(int,input().split()) map(int,input().split()) N Q = map(int,input().split()) map(int,input().split()) Q S, T, X = map(int,input().split()) map(int,input().split()) S
import heapq

N, Q = map(int,input().split())

events = []

for _ in range(N):
    S, T, X = map(int,input().split())

    events.append([S-X, 1, X])
    events.append([T-X, 0, X])

for _ in range(Q):
    D = int(input())
    events.append([D,2,0])

events.sort()

closed = set()
que = []

idx = 0
for time, flag, position in events:
    if flag == 0:
        closed.remove(position)
    elif flag == 1:
        heapq.heappush(que, position)
        closed.add(position)
    else:
        while len(que) > 0 and que[0] not in closed:
            heapq.heappop(que)

        if len(que) > 0:
            print(que[0])
        else:
            print(-1)