from heapq import heappush, heappop
import sys
input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
E = []

for i in range(N):
    s, t, x = map(int, input().split())
    E.append((0, t - x, x, i))
    E.append((1, s - x, x, i))

D = [int(input()) for _ in range(Q)]

E.sort(key=lambda a: a[1], reverse=True)

ans = []
que = [(10**18, -1)]
V = set()
for d in D:
    while E and E[-1][1] <= d:
        f, _, x, i = E.pop()
        if f == 0:
            V.add(i)
        else:
            heappush(que, (x, i))
    while que[0][1] in V:
        heappop(que)
    ans.append(que[0][0])

ans = [a if a < 10**18 else -1 for a in ans]
print(*ans, sep='\n') from heapq import heappush, heappop import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q E = [] E [] for i in range(N):
    s, t, x = map(int, input().split())
    E.append((0, t - x, x, i))
    E.append((1, s - x, x, i)) 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 E.append((0, t - x, x, i)) E.append E append (0, t - x, x, i) 0 t - x t x x i E.append((1, s - x, x, i)) E.append E append (1, s - x, x, i) 1 s - x s x x i 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)] E.sort(key=lambda a: a[1], reverse=True) E.sort E sort key=lambda a: a[1] key lambda a: a[1] a[1] a 1 a reverse=True reverse True ans = [] ans [] que = [(10**18, -1)] que [(10**18, -1)] (10**18, -1) 10**18 10 18 -1 V = set() V set() set for d in D:
    while E and E[-1][1] <= d:
        f, _, x, i = E.pop()
        if f == 0:
            V.add(i)
        else:
            heappush(que, (x, i))
    while que[0][1] in V:
        heappop(que)
    ans.append(que[0][0]) d D while E and E[-1][1] <= d:
        f, _, x, i = E.pop()
        if f == 0:
            V.add(i)
        else:
            heappush(que, (x, i))
     E and E[-1][1] <= d E E[-1][1] <= d E[-1][1] [-1] E -1 1 d f, _, x, i = E.pop() f E.pop() E.pop E pop _ x i if f == 0:
            V.add(i)
        else:
            heappush(que, (x, i))
     f == 0 f 0 V.add(i) V.add V add i heappush(que, (x, i)) heappush que (x, i) x i while que[0][1] in V:
        heappop(que)
     que[0][1] in V que[0][1] [0] que 0 1 V heappop(que) heappop que ans.append(que[0][0]) ans.append ans append que[0][0] [0] que 0 0 a if a < 10**18 else -1 for a in ans for a in ans a ans for a in ans a if a < 10**18 else -1 a < 10**18 a 10**18 10 18 a -1 ans = [a if a < 10**18 else -1 for a in ans] ans [a if a < 10**18 else -1 for a in ans] print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' que = [(10**18, -1)] [(10**18, -1)] que x = map(int, input().split()) map(int, input().split()) x N, Q = map(int, input().split()) map(int, input().split()) N f, _, x, i = E.pop() E.pop() f input = sys.stdin.buffer.readline sys.stdin.buffer.readline input Q = map(int, input().split()) map(int, input().split()) Q ans = [] [] ans t, x = map(int, input().split()) map(int, input().split()) t V = set() set() V _, x, i = E.pop() E.pop() _ s, t, x = map(int, input().split()) map(int, input().split()) s i = E.pop() E.pop() i x, i = E.pop() E.pop() x E = [] [] E ans = [a if a < 10**18 else -1 for a in ans] [a if a < 10**18 else -1 for a in ans] ans D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D
from heapq import heappush, heappop
import sys
input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
E = []

for i in range(N):
    s, t, x = map(int, input().split())
    E.append((0, t - x, x, i))
    E.append((1, s - x, x, i))

D = [int(input()) for _ in range(Q)]

E.sort(key=lambda a: a[1], reverse=True)

ans = []
que = [(10**18, -1)]
V = set()
for d in D:
    while E and E[-1][1] <= d:
        f, _, x, i = E.pop()
        if f == 0:
            V.add(i)
        else:
            heappush(que, (x, i))
    while que[0][1] in V:
        heappop(que)
    ans.append(que[0][0])

ans = [a if a < 10**18 else -1 for a in ans]
print(*ans, sep='\n')
