import sys
input = sys.stdin.readline

from heapq import heappop, heappush
from collections import defaultdict

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

lst = []
l_append = lst.append
for i in range(N):
    s, t, x = map(int, input().split())
    l_append((t - x, 0, x)) #xで止まらなくなる
    l_append((s - x, 1, x)) #xで止まる

for i in range(Q):
    l_append((int(input()), 2, i))

lst.sort()
ans = [-1] * Q

#引っかかっている場所の管理
se = set()
se_hp = [] #heapで最小値を先頭に保つ

#小さい時刻から順に見ていく
# s_remove = se.remove
# s_add = se.add
for a, b, c in lst:
    if b == 0:
        se.remove(c)
    elif b == 1:
        se.add(c)
        heappush(se_hp, c)
    else:
        while se_hp and se_hp[0] not in se:
            heappop(se_hp)
        ans[c] = se_hp[0] if se_hp else -1

print ('\n'.join(map(str, ans))) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from heapq import heappop, heappush from collections import defaultdict N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q lst = [] lst [] l_append = lst.append l_append lst.append lst append for i in range(N):
    s, t, x = map(int, input().split())
    l_append((t - x, 0, x)) #xで止まらなくなる
    l_append((s - x, 1, x)) #xで止まる i 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 l_append((t - x, 0, x)) l_append (t - x, 0, x) t - x t x 0 x l_append((s - x, 1, x)) l_append (s - x, 1, x) s - x s x 1 x for i in range(Q):
    l_append((int(input()), 2, i)) i range(Q) range Q l_append((int(input()), 2, i)) l_append (int(input()), 2, i) int(input()) int input() input 2 i lst.sort() lst.sort lst sort ans = [-1] * Q ans [-1] * Q [-1] -1 Q se = set() se set() set se_hp = [] se_hp [] for a, b, c in lst:
    if b == 0:
        se.remove(c)
    elif b == 1:
        se.add(c)
        heappush(se_hp, c)
    else:
        while se_hp and se_hp[0] not in se:
            heappop(se_hp)
        ans[c] = se_hp[0] if se_hp else -1 a b c lst if b == 0:
        se.remove(c)
    elif b == 1:
        se.add(c)
        heappush(se_hp, c)
    else:
        while se_hp and se_hp[0] not in se:
            heappop(se_hp)
        ans[c] = se_hp[0] if se_hp else -1 b == 0 b 0 se.remove(c) se.remove se remove c elif b == 1:
        se.add(c)
        heappush(se_hp, c)
     b == 1 b 1 se.add(c) se.add se add c heappush(se_hp, c) heappush se_hp c while se_hp and se_hp[0] not in se:
            heappop(se_hp)
         se_hp and se_hp[0] not in se se_hp se_hp[0] not in se se_hp[0] se_hp 0 se heappop(se_hp) heappop se_hp ans[c] = se_hp[0] if se_hp else -1 ans[c] ans c se_hp[0] if se_hp else -1 se_hp se_hp[0] se_hp 0 -1 print ('\n'.join(map(str, ans))) print '\n'.join(map(str, ans)) '\n'.join '\n' join map(str, ans) map str ans lst = [] [] lst Q = map(int, input().split()) map(int, input().split()) Q se_hp = [] [] se_hp l_append = lst.append lst.append l_append s, t, x = map(int, input().split()) map(int, input().split()) s ans = [-1] * Q [-1] * Q ans input = sys.stdin.readline sys.stdin.readline input N, Q = map(int, input().split()) map(int, input().split()) N t, x = map(int, input().split()) map(int, input().split()) t x = map(int, input().split()) map(int, input().split()) x se = set() set() se
import sys
input = sys.stdin.readline

from heapq import heappop, heappush
from collections import defaultdict

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

lst = []
l_append = lst.append
for i in range(N):
    s, t, x = map(int, input().split())
    l_append((t - x, 0, x)) #xで止まらなくなる
    l_append((s - x, 1, x)) #xで止まる

for i in range(Q):
    l_append((int(input()), 2, i))

lst.sort()
ans = [-1] * Q

#引っかかっている場所の管理
se = set()
se_hp = [] #heapで最小値を先頭に保つ

#小さい時刻から順に見ていく
# s_remove = se.remove
# s_add = se.add
for a, b, c in lst:
    if b == 0:
        se.remove(c)
    elif b == 1:
        se.add(c)
        heappush(se_hp, c)
    else:
        while se_hp and se_hp[0] not in se:
            heappop(se_hp)
        ans[c] = se_hp[0] if se_hp else -1

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