import sys
from heapq import heappush, heappop


I = sys.stdin.readlines()
N, Q = map(int, I[0].split())
P = []
for i in range(1, N + 1):
    s, t, x = map(int, I[i].split())
    P.append((s - x, t - 1 - x, x))
P.sort()


q = []
cur = 0
ans = [-1] * Q
for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while cur < N and P[cur][0] <= d:
        s, t, x = P[cur]
        heappush(q, (x, t))
        cur += 1
    while q and q[0][1] < d:
        heappop(q)
    if q:
        ans[i - N - 1] = q[0][0]

print(*ans, sep='\n') import sys sys from heapq import heappush, heappop I = sys.stdin.readlines() I sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines N, Q = map(int, I[0].split()) N map(int, I[0].split()) map int I[0].split() [0].split [0] I 0 split Q P = [] P [] for i in range(1, N + 1):
    s, t, x = map(int, I[i].split())
    P.append((s - x, t - 1 - x, x)) i range(1, N + 1) range 1 N + 1 N 1 s, t, x = map(int, I[i].split()) s map(int, I[i].split()) map int I[i].split() [i].split [i] I i split t x P.append((s - x, t - 1 - x, x)) P.append P append (s - x, t - 1 - x, x) s - x s x t - 1 - x t - 1 t 1 x x P.sort() P.sort P sort q = [] q [] cur = 0 cur 0 ans = [-1] * Q ans [-1] * Q [-1] -1 Q for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while cur < N and P[cur][0] <= d:
        s, t, x = P[cur]
        heappush(q, (x, t))
        cur += 1
    while q and q[0][1] < d:
        heappop(q)
    if q:
        ans[i - N - 1] = q[0][0] i range(N + 1, N + Q + 1) range N + 1 N 1 N + Q + 1 N + Q N Q 1 d = int(I[i]) d int(I[i]) int I[i] I i while cur < N and P[cur][0] <= d:
        s, t, x = P[cur]
        heappush(q, (x, t))
        cur += 1
     cur < N and P[cur][0] <= d cur < N cur N P[cur][0] <= d P[cur][0] [cur] P cur 0 d s, t, x = P[cur] s P[cur] P cur t x heappush(q, (x, t)) heappush q (x, t) x t cur += 1 cur 1 while q and q[0][1] < d:
        heappop(q)
     q and q[0][1] < d q q[0][1] < d q[0][1] [0] q 0 1 d heappop(q) heappop q if q:
        ans[i - N - 1] = q[0][0] q ans[i - N - 1] = q[0][0] ans[i - N - 1] ans i - N - 1 i - N i N 1 q[0][0] [0] q 0 0 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' N, Q = map(int, I[0].split()) map(int, I[0].split()) N t, x = P[cur] P[cur] t s, t, x = P[cur] P[cur] s I = sys.stdin.readlines() sys.stdin.readlines() I P = [] [] P cur += 1 1 cur q = [] [] q s, t, x = map(int, I[i].split()) map(int, I[i].split()) s x = map(int, I[i].split()) map(int, I[i].split()) x Q = map(int, I[0].split()) map(int, I[0].split()) Q x = P[cur] P[cur] x cur = 0 0 cur ans = [-1] * Q [-1] * Q ans t, x = map(int, I[i].split()) map(int, I[i].split()) t d = int(I[i]) int(I[i]) d
import sys
from heapq import heappush, heappop


I = sys.stdin.readlines()
N, Q = map(int, I[0].split())
P = []
for i in range(1, N + 1):
    s, t, x = map(int, I[i].split())
    P.append((s - x, t - 1 - x, x))
P.sort()


q = []
cur = 0
ans = [-1] * Q
for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while cur < N and P[cur][0] <= d:
        s, t, x = P[cur]
        heappush(q, (x, t))
        cur += 1
    while q and q[0][1] < d:
        heappop(q)
    if q:
        ans[i - N - 1] = q[0][0]

print(*ans, sep='\n')
