from heapq import heappush, heappop
import sys

input = sys.stdin.buffer.readline


n, q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(n)]
task = []
for s, t, x in STX:
    task.append((t - x, 0, x))
    task.append((s - x, 1, x))
for i in range(q):
    d = int(input())
    task.append((d, 2, i))

task.sort()
kouho = set()
kouho_hp = []
ans = [-1] * q
for a, b, c in task:
    if b == 0:
        kouho.remove(c)
    if b == 1:
        kouho.add(c)
        heappush(kouho_hp, c)
    if b == 2:
        while kouho_hp and kouho_hp[0] not in kouho:
            heappop(kouho_hp)
        if not kouho_hp:
            continue
        else:
            ans[c] = kouho_hp[0]
        # heapは0-indexが最小値になっているからheapified_list[0]でもよい
print(*ans, sep="\n") from heapq import heappush, heappop import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split STX = [list(map(int, input().split())) for _ in range(n)] STX [list(map(int, input().split())) for _ in range(n)] task = [] task [] for s, t, x in STX:
    task.append((t - x, 0, x))
    task.append((s - x, 1, x)) s t x STX task.append((t - x, 0, x)) task.append task append (t - x, 0, x) t - x t x 0 x task.append((s - x, 1, x)) task.append task append (s - x, 1, x) s - x s x 1 x for i in range(q):
    d = int(input())
    task.append((d, 2, i)) i range(q) range q d = int(input()) d int(input()) int input() input task.append((d, 2, i)) task.append task append (d, 2, i) d 2 i task.sort() task.sort task sort kouho = set() kouho set() set kouho_hp = [] kouho_hp [] ans = [-1] * q ans [-1] * q [-1] -1 q for a, b, c in task:
    if b == 0:
        kouho.remove(c)
    if b == 1:
        kouho.add(c)
        heappush(kouho_hp, c)
    if b == 2:
        while kouho_hp and kouho_hp[0] not in kouho:
            heappop(kouho_hp)
        if not kouho_hp:
            continue
        else:
            ans[c] = kouho_hp[0]
        # heapは0-indexが最小値になっているからheapified_list[0]でもよい a b c task if b == 0:
        kouho.remove(c)
     b == 0 b 0 kouho.remove(c) kouho.remove kouho remove c if b == 1:
        kouho.add(c)
        heappush(kouho_hp, c)
     b == 1 b 1 kouho.add(c) kouho.add kouho add c heappush(kouho_hp, c) heappush kouho_hp c if b == 2:
        while kouho_hp and kouho_hp[0] not in kouho:
            heappop(kouho_hp)
        if not kouho_hp:
            continue
        else:
            ans[c] = kouho_hp[0]
        # heapは0-indexが最小値になっているからheapified_list[0]でもよい b == 2 b 2 while kouho_hp and kouho_hp[0] not in kouho:
            heappop(kouho_hp)
         kouho_hp and kouho_hp[0] not in kouho kouho_hp kouho_hp[0] not in kouho kouho_hp[0] kouho_hp 0 kouho heappop(kouho_hp) heappop kouho_hp if not kouho_hp:
            continue
        else:
            ans[c] = kouho_hp[0]
        # heapは0-indexが最小値になっているからheapified_list[0]でもよい not kouho_hp kouho_hp continue ans[c] = kouho_hp[0] ans[c] ans c kouho_hp[0] kouho_hp 0 print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" task = [] [] task n, q = map(int, input().split()) map(int, input().split()) n kouho = set() set() kouho kouho_hp = [] [] kouho_hp input = sys.stdin.buffer.readline sys.stdin.buffer.readline input d = int(input()) int(input()) d ans = [-1] * q [-1] * q ans STX = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] STX q = map(int, input().split()) map(int, input().split()) q
from heapq import heappush, heappop
import sys

input = sys.stdin.buffer.readline


n, q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(n)]
task = []
for s, t, x in STX:
    task.append((t - x, 0, x))
    task.append((s - x, 1, x))
for i in range(q):
    d = int(input())
    task.append((d, 2, i))

task.sort()
kouho = set()
kouho_hp = []
ans = [-1] * q
for a, b, c in task:
    if b == 0:
        kouho.remove(c)
    if b == 1:
        kouho.add(c)
        heappush(kouho_hp, c)
    if b == 2:
        while kouho_hp and kouho_hp[0] not in kouho:
            heappop(kouho_hp)
        if not kouho_hp:
            continue
        else:
            ans[c] = kouho_hp[0]
        # heapは0-indexが最小値になっているからheapified_list[0]でもよい
print(*ans, sep="\n")
