from bisect import bisect_left
import heapq
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

events = []
for s, t, x in stx:
    events.append((s-x, 1, x))
    events.append((t-x, -1, x))
events.sort(key=lambda x: x[0])

hp = []
st = set()
res = [-1] * q
now = 0
for t, b, x in events:
    while now < q and d[now] < t:
        if len(st) > 0:
            while hp[0] not in st:
                heapq.heappop(hp)
            res[now] = hp[0]
        now += 1
    if b == 1:
        heapq.heappush(hp, x)
        st.add(x)
    else:
        st.discard(x)
print(*res) from bisect import bisect_left import heapq heapq n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q tuple(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split stx = [tuple(map(int, input().split())) for _ in range(n)] stx [tuple(map(int, input().split())) for _ in range(n)] 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)] d [int(input()) for _ in range(q)] events = [] events [] for s, t, x in stx:
    events.append((s-x, 1, x))
    events.append((t-x, -1, x)) s t x stx events.append((s-x, 1, x)) events.append events append (s-x, 1, x) s-x s x 1 x events.append((t-x, -1, x)) events.append events append (t-x, -1, x) t-x t x -1 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 hp = [] hp [] st = set() st set() set res = [-1] * q res [-1] * q [-1] -1 q now = 0 now 0 for t, b, x in events:
    while now < q and d[now] < t:
        if len(st) > 0:
            while hp[0] not in st:
                heapq.heappop(hp)
            res[now] = hp[0]
        now += 1
    if b == 1:
        heapq.heappush(hp, x)
        st.add(x)
    else:
        st.discard(x) t b x events while now < q and d[now] < t:
        if len(st) > 0:
            while hp[0] not in st:
                heapq.heappop(hp)
            res[now] = hp[0]
        now += 1
     now < q and d[now] < t now < q now q d[now] < t d[now] d now t if len(st) > 0:
            while hp[0] not in st:
                heapq.heappop(hp)
            res[now] = hp[0]
         len(st) > 0 len(st) len st 0 while hp[0] not in st:
                heapq.heappop(hp)
             hp[0] not in st hp[0] hp 0 st heapq.heappop(hp) heapq.heappop heapq heappop hp res[now] = hp[0] res[now] res now hp[0] hp 0 now += 1 now 1 if b == 1:
        heapq.heappush(hp, x)
        st.add(x)
    else:
        st.discard(x) b == 1 b 1 heapq.heappush(hp, x) heapq.heappush heapq heappush hp x st.add(x) st.add st add x st.discard(x) st.discard st discard x print(*res) print *res res hp = [] [] hp stx = [tuple(map(int, input().split())) for _ in range(n)] [tuple(map(int, input().split())) for _ in range(n)] stx now += 1 1 now q = map(int, input().split()) map(int, input().split()) q st = set() set() st n, q = map(int, input().split()) map(int, input().split()) n now = 0 0 now d = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] d events = [] [] events res = [-1] * q [-1] * q res
from bisect import bisect_left
import heapq
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

events = []
for s, t, x in stx:
    events.append((s-x, 1, x))
    events.append((t-x, -1, x))
events.sort(key=lambda x: x[0])

hp = []
st = set()
res = [-1] * q
now = 0
for t, b, x in events:
    while now < q and d[now] < t:
        if len(st) > 0:
            while hp[0] not in st:
                heapq.heappop(hp)
            res[now] = hp[0]
        now += 1
    if b == 1:
        heapq.heappush(hp, x)
        st.add(x)
    else:
        st.discard(x)
print(*res)