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()
INF = float('inf')
P.append((INF, INF, INF))

q = []
cur = 0
s, t, x = P[cur]
for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while s <= d:
        heappush(q, (x, t))
        cur += 1
        s, t, x = P[cur]
    ans = -1
    while len(q) > 0:
        x1, t1 = q[0]
        if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
    print(ans)
 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 INF = float('inf') INF float('inf') float 'inf' P.append((INF, INF, INF)) P.append P append (INF, INF, INF) INF INF INF q = [] q [] cur = 0 cur 0 s, t, x = P[cur] s P[cur] P cur t x for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while s <= d:
        heappush(q, (x, t))
        cur += 1
        s, t, x = P[cur]
    ans = -1
    while len(q) > 0:
        x1, t1 = q[0]
        if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
    print(ans) 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 s <= d:
        heappush(q, (x, t))
        cur += 1
        s, t, x = P[cur]
     s <= d s d heappush(q, (x, t)) heappush q (x, t) x t cur += 1 cur 1 s, t, x = P[cur] s P[cur] P cur t x ans = -1 ans -1 while len(q) > 0:
        x1, t1 = q[0]
        if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
     len(q) > 0 len(q) len q 0 x1, t1 = q[0] x1 q[0] q 0 t1 if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
     d <= t1 d t1 ans = x1 ans x1 break heappop(q) heappop q print(ans) print ans I = sys.stdin.readlines() sys.stdin.readlines() I t, x = P[cur] P[cur] t t1 = q[0] q[0] t1 cur = 0 0 cur INF = float('inf') float('inf') INF q = [] [] q s, t, x = P[cur] P[cur] s x = P[cur] P[cur] x x = P[cur] P[cur] x ans = x1 x1 ans P = [] [] P Q = map(int, I[0].split()) map(int, I[0].split()) Q s, t, x = P[cur] P[cur] s s, t, x = map(int, I[i].split()) map(int, I[i].split()) s t, x = P[cur] P[cur] t cur += 1 1 cur x = map(int, I[i].split()) map(int, I[i].split()) x d = int(I[i]) int(I[i]) d N, Q = map(int, I[0].split()) map(int, I[0].split()) N x1, t1 = q[0] q[0] x1 t, x = map(int, I[i].split()) map(int, I[i].split()) t ans = -1 -1 ans
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()
INF = float('inf')
P.append((INF, INF, INF))

q = []
cur = 0
s, t, x = P[cur]
for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while s <= d:
        heappush(q, (x, t))
        cur += 1
        s, t, x = P[cur]
    ans = -1
    while len(q) > 0:
        x1, t1 = q[0]
        if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
    print(ans)

