from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Q = map(int, readline().split())
STX = [[int(x) for x in readline().split()] for _ in range(N)]
EVENT = []
for s, t, x in STX:
    EVENT.append((s-x, 1, x))
    EVENT.append((t-x, 0, x))

for i in range(Q):
    d = int(readline())
    EVENT.append((d, 2, i))

ans = [-1] * Q

EVENT.sort()


STOP = set()
h = []
for t, op, x in EVENT:
    if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x)

print("\n".join(map(str, ans))) from heapq import heappush, heappop import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines N, Q = map(int, readline().split()) N map(int, readline().split()) map int readline().split() ().split () readline split Q [int(x) for x in readline().split()] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [int(x) for x in readline().split()] STX = [[int(x) for x in readline().split()] for _ in range(N)] STX [[int(x) for x in readline().split()] for _ in range(N)] EVENT = [] EVENT [] for s, t, x in STX:
    EVENT.append((s-x, 1, x))
    EVENT.append((t-x, 0, x)) s t x STX EVENT.append((s-x, 1, x)) EVENT.append EVENT append (s-x, 1, x) s-x s x 1 x EVENT.append((t-x, 0, x)) EVENT.append EVENT append (t-x, 0, x) t-x t x 0 x for i in range(Q):
    d = int(readline())
    EVENT.append((d, 2, i)) i range(Q) range Q d = int(readline()) d int(readline()) int readline() readline EVENT.append((d, 2, i)) EVENT.append EVENT append (d, 2, i) d 2 i ans = [-1] * Q ans [-1] * Q [-1] -1 Q EVENT.sort() EVENT.sort EVENT sort STOP = set() STOP set() set h = [] h [] for t, op, x in EVENT:
    if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x) t op x EVENT if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x) op == 2 and STOP op == 2 op 2 STOP while h and h[0] not in STOP:
            heappop(h)
         h and h[0] not in STOP h h[0] not in STOP h[0] h 0 STOP heappop(h) heappop h ans[x] = h[0] ans[x] ans x h[0] h 0 elif op == 1:
        STOP.add(x)
        heappush(h, x)
     op == 1 op 1 STOP.add(x) STOP.add STOP add x heappush(h, x) heappush h x elif op == 0:
        STOP.remove(x) op == 0 op 0 STOP.remove(x) STOP.remove STOP remove x print("\n".join(map(str, ans))) print "\n".join(map(str, ans)) "\n".join "\n" join map(str, ans) map str ans read = sys.stdin.buffer.read sys.stdin.buffer.read read STX = [[int(x) for x in readline().split()] for _ in range(N)] [[int(x) for x in readline().split()] for _ in range(N)] STX N, Q = map(int, readline().split()) map(int, readline().split()) N STOP = set() set() STOP readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline h = [] [] h ans = [-1] * Q [-1] * Q ans EVENT = [] [] EVENT d = int(readline()) int(readline()) d Q = map(int, readline().split()) map(int, readline().split()) Q readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Q = map(int, readline().split())
STX = [[int(x) for x in readline().split()] for _ in range(N)]
EVENT = []
for s, t, x in STX:
    EVENT.append((s-x, 1, x))
    EVENT.append((t-x, 0, x))

for i in range(Q):
    d = int(readline())
    EVENT.append((d, 2, i))

ans = [-1] * Q

EVENT.sort()


STOP = set()
h = []
for t, op, x in EVENT:
    if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x)

print("\n".join(map(str, ans)))
