from operator import itemgetter
import sys

input = sys.stdin.readline

inf = float('inf')

N, Q = map(int, input().split())

events = []
method_events_append = events.append

for _ in range(N):
    s, t, x = map(int, input().split())
    method_events_append((s - x, 1, x))  # add_event
    method_events_append((t - x, -1, x))  # remove_event

events.sort(key=itemgetter(0))  # イベント処理時刻昇順ソート

under_construction = set()
method_uc_add = under_construction.add
method_uc_discard = under_construction.discard

min_stop = inf
not_chg_flg = True

cur = 0
for _ in range(Q):
    d = int(input())
    while cur < N * 2 and events[cur][0] <= d:
        exec_time, event_type, under_construction_x = events[cur]
        if event_type == 1:  # add_event
            method_uc_add(under_construction_x)
            if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
        else:  # remove_event
            method_uc_discard(under_construction_x)
            if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
        cur += 1

    if not not_chg_flg:
        min_stop = min(under_construction) if under_construction else inf
        not_chg_flg = True
    print(min_stop if min_stop != inf else -1) from operator import itemgetter import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline inf = float('inf') inf float('inf') float 'inf' N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q events = [] events [] method_events_append = events.append method_events_append events.append events append for _ in range(N):
    s, t, x = map(int, input().split())
    method_events_append((s - x, 1, x))  # add_event
    method_events_append((t - x, -1, x))  # remove_event _ range(N) range N s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x method_events_append((s - x, 1, x)) method_events_append (s - x, 1, x) s - x s x 1 x method_events_append((t - x, -1, x)) method_events_append (t - x, -1, x) t - x t x -1 x events.sort(key=itemgetter(0)) events.sort events sort key=itemgetter(0) key itemgetter(0) itemgetter 0 under_construction = set() under_construction set() set method_uc_add = under_construction.add method_uc_add under_construction.add under_construction add method_uc_discard = under_construction.discard method_uc_discard under_construction.discard under_construction discard min_stop = inf min_stop inf not_chg_flg = True not_chg_flg True cur = 0 cur 0 for _ in range(Q):
    d = int(input())
    while cur < N * 2 and events[cur][0] <= d:
        exec_time, event_type, under_construction_x = events[cur]
        if event_type == 1:  # add_event
            method_uc_add(under_construction_x)
            if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
        else:  # remove_event
            method_uc_discard(under_construction_x)
            if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
        cur += 1

    if not not_chg_flg:
        min_stop = min(under_construction) if under_construction else inf
        not_chg_flg = True
    print(min_stop if min_stop != inf else -1) _ range(Q) range Q d = int(input()) d int(input()) int input() input while cur < N * 2 and events[cur][0] <= d:
        exec_time, event_type, under_construction_x = events[cur]
        if event_type == 1:  # add_event
            method_uc_add(under_construction_x)
            if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
        else:  # remove_event
            method_uc_discard(under_construction_x)
            if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
        cur += 1

     cur < N * 2 and events[cur][0] <= d cur < N * 2 cur N * 2 N 2 events[cur][0] <= d events[cur][0] [cur] events cur 0 d exec_time, event_type, under_construction_x = events[cur] exec_time events[cur] events cur event_type under_construction_x if event_type == 1:  # add_event
            method_uc_add(under_construction_x)
            if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
        else:  # remove_event
            method_uc_discard(under_construction_x)
            if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
         event_type == 1 event_type 1 method_uc_add(under_construction_x) method_uc_add under_construction_x if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
         not_chg_flg min_stop = min(min_stop, under_construction_x) min_stop min(min_stop, under_construction_x) min min_stop under_construction_x method_uc_discard(under_construction_x) method_uc_discard under_construction_x if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
         not_chg_flg and min_stop == under_construction_x not_chg_flg min_stop == under_construction_x min_stop under_construction_x not_chg_flg = False not_chg_flg False cur += 1 cur 1 if not not_chg_flg:
        min_stop = min(under_construction) if under_construction else inf
        not_chg_flg = True
     not not_chg_flg not_chg_flg min_stop = min(under_construction) if under_construction else inf min_stop min(under_construction) if under_construction else inf under_construction min(under_construction) min under_construction inf not_chg_flg = True not_chg_flg True print(min_stop if min_stop != inf else -1) print min_stop if min_stop != inf else -1 min_stop != inf min_stop inf min_stop -1 under_construction = set() set() under_construction input = sys.stdin.readline sys.stdin.readline input t, x = map(int, input().split()) map(int, input().split()) t x = map(int, input().split()) map(int, input().split()) x d = int(input()) int(input()) d not_chg_flg = False False not_chg_flg inf = float('inf') float('inf') inf not_chg_flg = True True not_chg_flg min_stop = min(min_stop, under_construction_x) min(min_stop, under_construction_x) min_stop min_stop = inf inf min_stop method_events_append = events.append events.append method_events_append not_chg_flg = True True not_chg_flg N, Q = map(int, input().split()) map(int, input().split()) N events = [] [] events cur = 0 0 cur event_type, under_construction_x = events[cur] events[cur] event_type s, t, x = map(int, input().split()) map(int, input().split()) s method_uc_discard = under_construction.discard under_construction.discard method_uc_discard min_stop = min(under_construction) if under_construction else inf min(under_construction) if under_construction else inf min_stop method_uc_add = under_construction.add under_construction.add method_uc_add Q = map(int, input().split()) map(int, input().split()) Q under_construction_x = events[cur] events[cur] under_construction_x exec_time, event_type, under_construction_x = events[cur] events[cur] exec_time cur += 1 1 cur
from operator import itemgetter
import sys

input = sys.stdin.readline

inf = float('inf')

N, Q = map(int, input().split())

events = []
method_events_append = events.append

for _ in range(N):
    s, t, x = map(int, input().split())
    method_events_append((s - x, 1, x))  # add_event
    method_events_append((t - x, -1, x))  # remove_event

events.sort(key=itemgetter(0))  # イベント処理時刻昇順ソート

under_construction = set()
method_uc_add = under_construction.add
method_uc_discard = under_construction.discard

min_stop = inf
not_chg_flg = True

cur = 0
for _ in range(Q):
    d = int(input())
    while cur < N * 2 and events[cur][0] <= d:
        exec_time, event_type, under_construction_x = events[cur]
        if event_type == 1:  # add_event
            method_uc_add(under_construction_x)
            if not_chg_flg:  # この分岐がないとdiscardされたmin_stopと比較する恐れがある
                min_stop = min(min_stop, under_construction_x)
        else:  # remove_event
            method_uc_discard(under_construction_x)
            if not_chg_flg and min_stop == under_construction_x:
                not_chg_flg = False
        cur += 1

    if not not_chg_flg:
        min_stop = min(under_construction) if under_construction else inf
        not_chg_flg = True
    print(min_stop if min_stop != inf else -1)
