from collections import deque, defaultdict
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
events = [None] * (2*N)
for i in range(N):
    S, T, X = map(int, input().split())
    events[2*i] = (S-X, X)
    events[2*i+1] = (T-X, -X)
events.sort(key=lambda x: x[0])
events = deque(events)
ans = [0] * Q
cur = []
remove = defaultdict(int)
for i in range(Q):
    D = int(input())
    while events and events[0][0] <= D:
        t, x = events.popleft()
        if x > 0:
            heappush(cur, x)
        else:
            remove[-x] += 1
    while cur and remove[cur[0]]:
        remove[cur[0]] -= 1
        heappop(cur)
    ans[i] = cur[0] if cur else -1
print(*ans, sep='\n') from collections import deque, defaultdict from heapq import heappush, heappop import sys 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 events = [None] * (2*N) events [None] * (2*N) [None] None 2*N 2 N for i in range(N):
    S, T, X = map(int, input().split())
    events[2*i] = (S-X, X)
    events[2*i+1] = (T-X, -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 events[2*i] = (S-X, X) events[2*i] events 2*i 2 i (S-X, X) S-X S X X events[2*i+1] = (T-X, -X) events[2*i+1] events 2*i+1 2*i 2 i 1 (T-X, -X) T-X T X -X X events.sort(key=lambda x: x[0]) events.sort events sort key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x events = deque(events) events deque(events) deque events ans = [0] * Q ans [0] * Q [0] 0 Q cur = [] cur [] remove = defaultdict(int) remove defaultdict(int) defaultdict int for i in range(Q):
    D = int(input())
    while events and events[0][0] <= D:
        t, x = events.popleft()
        if x > 0:
            heappush(cur, x)
        else:
            remove[-x] += 1
    while cur and remove[cur[0]]:
        remove[cur[0]] -= 1
        heappop(cur)
    ans[i] = cur[0] if cur else -1 i range(Q) range Q D = int(input()) D int(input()) int input() input while events and events[0][0] <= D:
        t, x = events.popleft()
        if x > 0:
            heappush(cur, x)
        else:
            remove[-x] += 1
     events and events[0][0] <= D events events[0][0] <= D events[0][0] [0] events 0 0 D t, x = events.popleft() t events.popleft() events.popleft events popleft x if x > 0:
            heappush(cur, x)
        else:
            remove[-x] += 1
     x > 0 x 0 heappush(cur, x) heappush cur x remove[-x] += 1 remove[-x] remove -x x 1 while cur and remove[cur[0]]:
        remove[cur[0]] -= 1
        heappop(cur)
     cur and remove[cur[0]] cur remove[cur[0]] remove cur[0] cur 0 remove[cur[0]] -= 1 remove[cur[0]] remove cur[0] cur 0 1 heappop(cur) heappop cur ans[i] = cur[0] if cur else -1 ans[i] ans i cur[0] if cur else -1 cur cur[0] cur 0 -1 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' ans = [0] * Q [0] * Q ans S, T, X = map(int, input().split()) map(int, input().split()) S cur = [] [] cur remove = defaultdict(int) defaultdict(int) remove events = [None] * (2*N) [None] * (2*N) events X = map(int, input().split()) map(int, input().split()) X Q = map(int, input().split()) map(int, input().split()) Q input = sys.stdin.readline sys.stdin.readline input x = events.popleft() events.popleft() x D = int(input()) int(input()) D T, X = map(int, input().split()) map(int, input().split()) T events = deque(events) deque(events) events N, Q = map(int, input().split()) map(int, input().split()) N t, x = events.popleft() events.popleft() t
from collections import deque, defaultdict
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
events = [None] * (2*N)
for i in range(N):
    S, T, X = map(int, input().split())
    events[2*i] = (S-X, X)
    events[2*i+1] = (T-X, -X)
events.sort(key=lambda x: x[0])
events = deque(events)
ans = [0] * Q
cur = []
remove = defaultdict(int)
for i in range(Q):
    D = int(input())
    while events and events[0][0] <= D:
        t, x = events.popleft()
        if x > 0:
            heappush(cur, x)
        else:
            remove[-x] += 1
    while cur and remove[cur[0]]:
        remove[cur[0]] -= 1
        heappop(cur)
    ans[i] = cur[0] if cur else -1
print(*ans, sep='\n')
