# coding: utf-8
import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
STX.sort(key=lambda x: x[2], reverse=True)
event = []
for s, t, x in STX:
    event.append((s-x, 0, x))
    event.append((t-x, -1, x))

for i in range(Q):
    d = ir()
    event.append((d, 1, i))

event.sort()
answer = [-1] * Q
cur = set()
flag = False
INF = 10 ** 10
min_x = INF
for a, b, c in event:
    if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x

print('\n'.join(map(str, answer)))
# 19 import sys sys from heapq import heapify, heappop, heappush sr = lambda: sys.stdin.readline().rstrip() sr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split N, Q = lr() N lr() lr Q tuple(lr()) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(lr()) tuple lr() lr STX = [tuple(lr()) for _ in range(N)] STX [tuple(lr()) for _ in range(N)] STX.sort(key=lambda x: x[2], reverse=True) STX.sort STX sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse=True reverse True event = [] event [] for s, t, x in STX:
    event.append((s-x, 0, x))
    event.append((t-x, -1, x)) s t x STX event.append((s-x, 0, x)) event.append event append (s-x, 0, x) s-x s x 0 x event.append((t-x, -1, x)) event.append event append (t-x, -1, x) t-x t x -1 x for i in range(Q):
    d = ir()
    event.append((d, 1, i)) i range(Q) range Q d = ir() d ir() ir event.append((d, 1, i)) event.append event append (d, 1, i) d 1 i event.sort() event.sort event sort answer = [-1] * Q answer [-1] * Q [-1] -1 Q cur = set() cur set() set flag = False flag False INF = 10 ** 10 INF 10 ** 10 10 10 min_x = INF min_x INF for a, b, c in event:
    if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x a b c event if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x b == 0 b 0 cur.add(c) cur.add cur add c if c < min_x:
            min_x = c
            flag = True
     c < min_x c min_x min_x = c min_x c flag = True flag True elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
     b == -1 b -1 cur.remove(c) cur.remove cur remove c if min_x == c:
            flag = False
     min_x == c min_x c flag = False flag False elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x b == 1 b 1 if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x cur if not flag:
                min_x = min(cur)
                flag = True
             not flag flag min_x = min(cur) min_x min(cur) min cur flag = True flag True answer[c] = min_x answer[c] answer c min_x print('\n'.join(map(str, answer))) print '\n'.join(map(str, answer)) '\n'.join '\n' join map(str, answer) map str answer INF = 10 ** 10 10 ** 10 INF sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr event = [] [] event cur = set() set() cur ir = lambda: int(sr()) lambda: int(sr()) ir N, Q = lr() lr() N d = ir() ir() d STX = [tuple(lr()) for _ in range(N)] [tuple(lr()) for _ in range(N)] STX flag = False False flag answer = [-1] * Q [-1] * Q answer flag = True True flag min_x = min(cur) min(cur) min_x flag = False False flag flag = True True flag min_x = c c min_x Q = lr() lr() Q lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr min_x = INF INF min_x
# coding: utf-8
import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
STX.sort(key=lambda x: x[2], reverse=True)
event = []
for s, t, x in STX:
    event.append((s-x, 0, x))
    event.append((t-x, -1, x))

for i in range(Q):
    d = ir()
    event.append((d, 1, i))

event.sort()
answer = [-1] * Q
cur = set()
flag = False
INF = 10 ** 10
min_x = INF
for a, b, c in event:
    if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x

print('\n'.join(map(str, answer)))
# 19
