from collections import defaultdict
from heapq import heappush,heappop

# map(int, input().split())
N, Q = map(int, input().split())
events = []
for i in range(N):
    s, t, x = map(int, input().split())
    events.append((s - x, 0, x))
    events.append((t - x, 1, x))

for i in range(Q):
    d = int(input())
    events.append((d, 2, i))

events = sorted(events)
INF = 10**13
q = [INF]
cnt = defaultdict(int)
ans = [INF]*Q
for a,b,c in events:
    if b == 0:
        heappush(q,c)
        cnt[c] += 1
    elif b==1:
        cnt[c] -= 1
    else:
        while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0]
for a in ans:
    print(a) from collections import defaultdict from heapq import heappush,heappop N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q events = [] events [] for i in range(N):
    s, t, x = map(int, input().split())
    events.append((s - x, 0, x))
    events.append((t - x, 1, 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.append((s - x, 0, x)) events.append events append (s - x, 0, x) s - x s x 0 x events.append((t - x, 1, x)) events.append events append (t - x, 1, x) t - x t x 1 x for i in range(Q):
    d = int(input())
    events.append((d, 2, i)) i range(Q) range Q d = int(input()) d int(input()) int input() input events.append((d, 2, i)) events.append events append (d, 2, i) d 2 i events = sorted(events) events sorted(events) sorted events INF = 10**13 INF 10**13 10 13 q = [INF] q [INF] INF cnt = defaultdict(int) cnt defaultdict(int) defaultdict int ans = [INF]*Q ans [INF]*Q [INF] INF Q for a,b,c in events:
    if b == 0:
        heappush(q,c)
        cnt[c] += 1
    elif b==1:
        cnt[c] -= 1
    else:
        while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0] a b c events if b == 0:
        heappush(q,c)
        cnt[c] += 1
    elif b==1:
        cnt[c] -= 1
    else:
        while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0] b == 0 b 0 heappush(q,c) heappush q c cnt[c] += 1 cnt[c] cnt c 1 elif b==1:
        cnt[c] -= 1
     b==1 b 1 cnt[c] -= 1 cnt[c] cnt c 1 while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
         len(q) > 1 and cnt[q[0]] == 0 len(q) > 1 len(q) len q 1 cnt[q[0]] == 0 cnt[q[0]] cnt q[0] q 0 0 heappop(q) heappop q if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0] q[0] == INF q[0] q 0 INF ans[c] = -1 ans[c] ans c -1 ans[c] = q[0] ans[c] ans c q[0] q 0 for a in ans:
    print(a) a ans print(a) print a s, t, x = map(int, input().split()) map(int, input().split()) s d = int(input()) int(input()) d events = [] [] events events = sorted(events) sorted(events) events N, Q = map(int, input().split()) map(int, input().split()) N t, x = map(int, input().split()) map(int, input().split()) t Q = map(int, input().split()) map(int, input().split()) Q cnt = defaultdict(int) defaultdict(int) cnt ans = [INF]*Q [INF]*Q ans x = map(int, input().split()) map(int, input().split()) x q = [INF] [INF] q INF = 10**13 10**13 INF
from collections import defaultdict
from heapq import heappush,heappop

# map(int, input().split())
N, Q = map(int, input().split())
events = []
for i in range(N):
    s, t, x = map(int, input().split())
    events.append((s - x, 0, x))
    events.append((t - x, 1, x))

for i in range(Q):
    d = int(input())
    events.append((d, 2, i))

events = sorted(events)
INF = 10**13
q = [INF]
cnt = defaultdict(int)
ans = [INF]*Q
for a,b,c in events:
    if b == 0:
        heappush(q,c)
        cnt[c] += 1
    elif b==1:
        cnt[c] -= 1
    else:
        while len(q) > 1 and cnt[q[0]] == 0:
            heappop(q)
        if q[0] == INF:
            ans[c] = -1
        else:
            ans[c] = q[0]
for a in ans:
    print(a)
