# -*- coding: utf-8 -*-

import sys
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, Q = MAP()
# 3種類の状態変化をイベントとして一括管理する
# 0: 工事終了, 1: 工事開始, 2: 人の出発
events = []
for i in range(N):
    s, t, x = MAP()
    # (開始座標に合わせた状態の工事開始時間, フラグ, 実際の座標)
    events.append((s-x, 1, x))
    # (開始座標に合わせた状態の工事終了時間, フラグ, 実際の座標)
    events.append((t-x, 0, x))
for i in range(Q):
    d = INT()
    # (人の出発時間, フラグ, index)
    events.append((d, 2, i))
# 時系列に沿ってソート、フラグも同時刻な時先に処理して欲しいものから番号を振ってある
events.sort()

# setとheapqを合わせて、時刻に合わせた処理と最小値取得を行う
S = set()
hp = []
ans = [0] * Q
for t, flag, x in events:
    # 工事終了
    if flag == 0:
        S.remove(x)
    # 工事開始
    elif flag == 1:
        S.add(x)
        heappush(hp, x)
    # 人の移動
    elif flag == 2:
        # heapqの先頭要素ついて、setと状態を合わせる
        while len(hp) and hp[0] not in S:
            heappop(hp)
        if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1
[print(a) for a in ans] import sys sys from heapq import heappush, heappop def input(): return sys.stdin.readline().strip() input [c] * b for i in range(a) for i in range(a) i range(a) range a for i in range(a) [c] * b [c] c b def list2d(a, b, c): return [[c] * b for i in range(a)] list2d a a b b c c [[d] * c for j in range(b)] for i in range(a) for i in range(a) i range(a) range a for i in range(a) [[d] * c for j in range(b)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] list3d a a b b c c d d [[[e] * d for j in range(c)] for j in range(b)] for i in range(a) for i in range(a) i range(a) range a for i in range(a) [[[e] * d for j in range(c)] for j in range(b)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] list4d a a b b c c d d e e def ceil(x, y=1): return int(-(-x // y)) ceil x x y=1 y 1 def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP INT() for i in range(N) for i in range(N) i range(N) range N for i in range(N) INT() INT def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] LIST N=None N None def Yes(): print('Yes') Yes def No(): print('No') No def YES(): print('YES') YES def NO(): print('NO') NO sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 N, Q = MAP() N MAP() MAP Q events = [] events [] for i in range(N):
    s, t, x = MAP()
    # (開始座標に合わせた状態の工事開始時間, フラグ, 実際の座標)
    events.append((s-x, 1, x))
    # (開始座標に合わせた状態の工事終了時間, フラグ, 実際の座標)
    events.append((t-x, 0, x)) i range(N) range N s, t, x = MAP() s MAP() MAP t x events.append((s-x, 1, x)) events.append events append (s-x, 1, x) s-x s x 1 x events.append((t-x, 0, x)) events.append events append (t-x, 0, x) t-x t x 0 x for i in range(Q):
    d = INT()
    # (人の出発時間, フラグ, index)
    events.append((d, 2, i))
# 時系列に沿ってソート、フラグも同時刻な時先に処理して欲しいものから番号を振ってある i range(Q) range Q d = INT() d INT() INT events.append((d, 2, i)) events.append events append (d, 2, i) d 2 i events.sort() events.sort events sort S = set() S set() set hp = [] hp [] ans = [0] * Q ans [0] * Q [0] 0 Q for t, flag, x in events:
    # 工事終了
    if flag == 0:
        S.remove(x)
    # 工事開始
    elif flag == 1:
        S.add(x)
        heappush(hp, x)
    # 人の移動
    elif flag == 2:
        # heapqの先頭要素ついて、setと状態を合わせる
        while len(hp) and hp[0] not in S:
            heappop(hp)
        if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1 t flag x events if flag == 0:
        S.remove(x)
    # 工事開始
    elif flag == 1:
        S.add(x)
        heappush(hp, x)
    # 人の移動
    elif flag == 2:
        # heapqの先頭要素ついて、setと状態を合わせる
        while len(hp) and hp[0] not in S:
            heappop(hp)
        if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1 flag == 0 flag 0 S.remove(x) S.remove S remove x elif flag == 1:
        S.add(x)
        heappush(hp, x)
    # 人の移動
     flag == 1 flag 1 S.add(x) S.add S add x heappush(hp, x) heappush hp x elif flag == 2:
        # heapqの先頭要素ついて、setと状態を合わせる
        while len(hp) and hp[0] not in S:
            heappop(hp)
        if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1 flag == 2 flag 2 while len(hp) and hp[0] not in S:
            heappop(hp)
         len(hp) and hp[0] not in S len(hp) len hp hp[0] not in S hp[0] hp 0 S heappop(hp) heappop hp if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1 len(hp) len hp ans[x] = hp[0] ans[x] ans x hp[0] hp 0 ans[x] = -1 ans[x] ans x -1 print(a) for a in ans for a in ans a ans for a in ans print(a) print a [print(a) for a in ans] N, Q = MAP() MAP() N t, x = MAP() MAP() t def ceil(x, y=1): return int(-(-x // y)) def ceil(x, y=1): return int(-(-x // y)) ceil def YES(): print('YES') def YES(): print('YES') YES MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def INT(): return int(input()) def INT(): return int(input()) INT S = set() set() S def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] list3d def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] LIST ans = [0] * Q [0] * Q ans def No(): print('No') def No(): print('No') No def NO(): print('NO') def NO(): print('NO') NO events = [] [] events x = MAP() MAP() x def Yes(): print('Yes') def Yes(): print('Yes') Yes Q = MAP() MAP() Q d = INT() INT() d hp = [] [] hp def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP INF = float('inf') float('inf') INF s, t, x = MAP() MAP() s def list2d(a, b, c): return [[c] * b for i in range(a)] def list2d(a, b, c): return [[c] * b for i in range(a)] list2d def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] list4d
# -*- coding: utf-8 -*-

import sys
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, Q = MAP()
# 3種類の状態変化をイベントとして一括管理する
# 0: 工事終了, 1: 工事開始, 2: 人の出発
events = []
for i in range(N):
    s, t, x = MAP()
    # (開始座標に合わせた状態の工事開始時間, フラグ, 実際の座標)
    events.append((s-x, 1, x))
    # (開始座標に合わせた状態の工事終了時間, フラグ, 実際の座標)
    events.append((t-x, 0, x))
for i in range(Q):
    d = INT()
    # (人の出発時間, フラグ, index)
    events.append((d, 2, i))
# 時系列に沿ってソート、フラグも同時刻な時先に処理して欲しいものから番号を振ってある
events.sort()

# setとheapqを合わせて、時刻に合わせた処理と最小値取得を行う
S = set()
hp = []
ans = [0] * Q
for t, flag, x in events:
    # 工事終了
    if flag == 0:
        S.remove(x)
    # 工事開始
    elif flag == 1:
        S.add(x)
        heappush(hp, x)
    # 人の移動
    elif flag == 2:
        # heapqの先頭要素ついて、setと状態を合わせる
        while len(hp) and hp[0] not in S:
            heappop(hp)
        if len(hp):
            ans[x] = hp[0]
        else:
            ans[x] = -1
[print(a) for a in ans]
