import sys
from heapq import heappush, heappop


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


q = []
cur = 0
ans = [-1] * Q
for i, d in enumerate(map(int, sys.stdin)):
    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] = q[0][0]

print(*ans, sep='\n') import sys sys from heapq import heappush, heappop N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q P = [] P [] for i in range(1, N + 1):
    s, t, x = map(int, sys.stdin.readline().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, sys.stdin.readline().split()) s map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline 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, d in enumerate(map(int, sys.stdin)):
    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] = q[0][0] i d enumerate(map(int, sys.stdin)) enumerate map(int, sys.stdin) map int sys.stdin sys stdin 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] = q[0][0] q ans[i] = q[0][0] ans[i] ans i q[0][0] [0] q 0 0 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' s, t, x = P[cur] P[cur] s P = [] [] P t, x = P[cur] P[cur] t Q = map(int, input().split()) map(int, input().split()) Q q = [] [] q x = P[cur] P[cur] x N, Q = map(int, input().split()) map(int, input().split()) N t, x = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) t cur += 1 1 cur x = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) x ans = [-1] * Q [-1] * Q ans s, t, x = map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) s cur = 0 0 cur
import sys
from heapq import heappush, heappop


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


q = []
cur = 0
ans = [-1] * Q
for i, d in enumerate(map(int, sys.stdin)):
    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] = q[0][0]

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