import heapq, sys
input = sys.stdin.readline
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))

for _ in range(q):
    d = int(input())
    event.append((d, 2, 0))

event.sort(key=lambda x: (x[0], x[1]))
now = []
memo = set()

tmp = 0

for i, (t, flg, x) in enumerate(event):
    if flg == -1:
        memo.remove(x)
    elif flg == 1:
        heapq.heappush(now, x)
        memo.add(x)
    else:
        while len(now) > 0 and now[0] not in memo:
            heapq.heappop(now)
        if len(now) > 0:
            print(now[0])
        else:
            print(-1) import heapq, sys heapq sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 for _ in range(q):
    d = int(input())
    event.append((d, 2, 0)) _ range(q) range q d = int(input()) d int(input()) int input() input event.append((d, 2, 0)) event.append event append (d, 2, 0) d 2 0 event.sort(key=lambda x: (x[0], x[1])) event.sort event sort key=lambda x: (x[0], x[1]) key lambda x: (x[0], x[1]) (x[0], x[1]) x[0] x 0 x[1] x 1 x now = [] now [] memo = set() memo set() set tmp = 0 tmp 0 for i, (t, flg, x) in enumerate(event):
    if flg == -1:
        memo.remove(x)
    elif flg == 1:
        heapq.heappush(now, x)
        memo.add(x)
    else:
        while len(now) > 0 and now[0] not in memo:
            heapq.heappop(now)
        if len(now) > 0:
            print(now[0])
        else:
            print(-1) i (t, flg, x) t flg x enumerate(event) enumerate event if flg == -1:
        memo.remove(x)
    elif flg == 1:
        heapq.heappush(now, x)
        memo.add(x)
    else:
        while len(now) > 0 and now[0] not in memo:
            heapq.heappop(now)
        if len(now) > 0:
            print(now[0])
        else:
            print(-1) flg == -1 flg -1 memo.remove(x) memo.remove memo remove x elif flg == 1:
        heapq.heappush(now, x)
        memo.add(x)
     flg == 1 flg 1 heapq.heappush(now, x) heapq.heappush heapq heappush now x memo.add(x) memo.add memo add x while len(now) > 0 and now[0] not in memo:
            heapq.heappop(now)
         len(now) > 0 and now[0] not in memo len(now) > 0 len(now) len now 0 now[0] not in memo now[0] now 0 memo heapq.heappop(now) heapq.heappop heapq heappop now if len(now) > 0:
            print(now[0])
        else:
            print(-1) len(now) > 0 len(now) len now 0 print(now[0]) print now[0] now 0 print(-1) print -1 input = sys.stdin.readline sys.stdin.readline input s, t, x = map(int, input().split()) map(int, input().split()) s d = int(input()) int(input()) d q = map(int, input().split()) map(int, input().split()) q x = map(int, input().split()) map(int, input().split()) x n, q = map(int, input().split()) map(int, input().split()) n now = [] [] now memo = set() set() memo tmp = 0 0 tmp event = [] [] event t, x = map(int, input().split()) map(int, input().split()) t
import heapq, sys
input = sys.stdin.readline
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))

for _ in range(q):
    d = int(input())
    event.append((d, 2, 0))

event.sort(key=lambda x: (x[0], x[1]))
now = []
memo = set()

tmp = 0

for i, (t, flg, x) in enumerate(event):
    if flg == -1:
        memo.remove(x)
    elif flg == 1:
        heapq.heappush(now, x)
        memo.add(x)
    else:
        while len(now) > 0 and now[0] not in memo:
            heapq.heappop(now)
        if len(now) > 0:
            print(now[0])
        else:
            print(-1)