def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, Q = getNM()
sec = [getList() for i in range(N)]
section = []
for i in range(N):
    s, t, x = sec[i]
    section.append([s - x, t - x])
query = getArray(Q)

# 各queryがどのsectionの開区間[s, t)内にあるか
def event_sort(section, query):
    s_n = len(section)
    q_n = len(query)
    task = []
    for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q_n):
        task.append((query[i], 2, i))
    task.sort()

    se = set()
    
    ### この問題専用 ###
    res = [-1] * q_n # 答え
    ignore = [-1] * s_n # まだ区間が生きているか
    se_hp = [] # ignoreを元にまだ生きている区間の中でのxの最小値を求める
    heapq.heapify(se_hp)
    ##################

    for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
    return res

for i in event_sort(section, query):
    print(i)

"""
# 各queryがどのsectionの開区間[s, t)内にあるか
def event_sort(section, query):
    s = len(section)
    q = len(query)
    # イベント生成
    task = []
    for i in range(s):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q):
        task.append((query[i], 2, i))
    task.sort()

    # 引っかかってる場所の管理
    se = set()

    for a, b, c in task:
        # ゴールが来ると削除
        if b == 1:
            se.remove(c)
        # スタートが来ると追加
        elif b == 0:
            se.add(c)
        # queについてなら
        else:
            print(se)

section = [
[-3, 3],
[-1, 1],
[5, 7],
[1, 2],
]

query = [0, 1, 2, 3]
# [{0, 1}, {0, 3}, {0}, set()]
event_sort(section, query)
""" def getN():
    return int(input()) getN return int(input()) int(input()) int input() input def getNM():
    return map(int, input().split()) getNM return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def getList():
    return list(map(int, input().split())) getList return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def getArray(intn):
    return [int(input()) for i in range(intn)] getArray int(input()) for i in range(intn) for i in range(intn) i range(intn) range intn for i in range(intn) int(input()) int input() input return [int(input()) for i in range(intn)] [int(input()) for i in range(intn)] intn intn def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) rand_N return random.randint(ran1, ran2) random.randint(ran1, ran2) random.randint random randint ran1 ran2 ran1 ran1 ran2 ran2 def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] rand_List random.randint(ran1, ran2) for i in range(rantime) for i in range(rantime) i range(rantime) range rantime for i in range(rantime) random.randint(ran1, ran2) random.randint random randint ran1 ran2 return [random.randint(ran1, ran2) for i in range(rantime)] [random.randint(ran1, ran2) for i in range(rantime)] ran1 ran1 ran2 ran2 rantime rantime def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) rand_ints_nodup ns = [] ns [] while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
   len(ns) < rantime len(ns) len ns rantime n = random.randint(ran1, ran2) n random.randint(ran1, ran2) random.randint random randint ran1 ran2 if not n in ns:
      ns.append(n)
   not n in ns n in ns n ns ns.append(n) ns.append ns append n return sorted(ns) sorted(ns) sorted ns ran1 ran1 ran2 ran2 rantime rantime def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) rand_query r_query = [] r_query [] while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
   len(r_query) < rantime len(r_query) len r_query rantime n_q = rand_ints_nodup(ran1, ran2, 2) n_q rand_ints_nodup(ran1, ran2, 2) rand_ints_nodup ran1 ran2 2 if not n_q in r_query:
      r_query.append(n_q)
   not n_q in r_query n_q in r_query n_q r_query r_query.append(n_q) r_query.append r_query append n_q return sorted(r_query) sorted(r_query) sorted r_query ran1 ran1 ran2 ran2 rantime rantime from collections import defaultdict, deque, Counter from sys import exit from decimal import * import heapq heapq import math math from fractions import gcd import random random import string string import copy copy from itertools import combinations, permutations, product from operator import mul, itemgetter from functools import reduce from bisect import bisect_left, bisect_right import sys sys sys.setrecursionlimit(1000000000) sys.setrecursionlimit sys setrecursionlimit 1000000000 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 N, Q = getNM() N getNM() getNM Q getList() for i in range(N) for i in range(N) i range(N) range N for i in range(N) getList() getList sec = [getList() for i in range(N)] sec [getList() for i in range(N)] section = [] section [] for i in range(N):
    s, t, x = sec[i]
    section.append([s - x, t - x]) i range(N) range N s, t, x = sec[i] s sec[i] sec i t x section.append([s - x, t - x]) section.append section append [s - x, t - x] s - x s x t - x t x query = getArray(Q) query getArray(Q) getArray Q def event_sort(section, query):
    s_n = len(section)
    q_n = len(query)
    task = []
    for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q_n):
        task.append((query[i], 2, i))
    task.sort()

    se = set()
    
    ### この問題専用 ###
    res = [-1] * q_n # 答え
    ignore = [-1] * s_n # まだ区間が生きているか
    se_hp = [] # ignoreを元にまだ生きている区間の中でのxの最小値を求める
    heapq.heapify(se_hp)
    ##################

    for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
    return res event_sort s_n = len(section) s_n len(section) len section q_n = len(query) q_n len(query) len query task = [] task [] for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
     i range(s_n) range s_n s, t = section[i] s section[i] section i t task.append((s, 0, i)) task.append task append (s, 0, i) s 0 i task.append((t, 1, i)) task.append task append (t, 1, i) t 1 i for i in range(q_n):
        task.append((query[i], 2, i))
     i range(q_n) range q_n task.append((query[i], 2, i)) task.append task append (query[i], 2, i) query[i] query i 2 i task.sort() task.sort task sort se = set() se set() set res = [-1] * q_n res [-1] * q_n [-1] -1 q_n ignore = [-1] * s_n ignore [-1] * s_n [-1] -1 s_n se_hp = [] se_hp [] heapq.heapify(se_hp) heapq.heapify heapq heapify se_hp for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
     a b c task if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
     b == 1 b 1 se.remove(c) se.remove se remove c ignore[c] = 1 ignore[c] ignore c 1 elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
         b == 0 b 0 se.add(c) se.add se add c heapq.heappush(se_hp, (sec[c][2], c)) heapq.heappush heapq heappush se_hp (sec[c][2], c) sec[c][2] [c] sec c 2 c while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
             se_hp and ignore[se_hp[0][1]] == 1 se_hp ignore[se_hp[0][1]] == 1 ignore[se_hp[0][1]] ignore se_hp[0][1] [0] se_hp 0 1 1 heapq.heappop(se_hp) heapq.heappop heapq heappop se_hp if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
     se_hp res[c] = se_hp[0][0] res[c] res c se_hp[0][0] [0] se_hp 0 0 res[c] = -1 res[c] res c -1 return res res section section query query for i in event_sort(section, query):
    print(i) i event_sort(section, query) event_sort section query print(i) print i """
# 各queryがどのsectionの開区間[s, t)内にあるか
def event_sort(section, query):
    s = len(section)
    q = len(query)
    # イベント生成
    task = []
    for i in range(s):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q):
        task.append((query[i], 2, i))
    task.sort()

    # 引っかかってる場所の管理
    se = set()

    for a, b, c in task:
        # ゴールが来ると削除
        if b == 1:
            se.remove(c)
        # スタートが来ると追加
        elif b == 0:
            se.add(c)
        # queについてなら
        else:
            print(se)

section = [
[-3, 3],
[-1, 1],
[5, 7],
[1, 2],
]

query = [0, 1, 2, 3]
# [{0, 1}, {0, 3}, {0}, set()]
event_sort(section, query)
""" t, x = sec[i] sec[i] t def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) rand_ints_nodup def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] rand_List section = [] [] section def getArray(intn):
    return [int(input()) for i in range(intn)] def getArray(intn):
    return [int(input()) for i in range(intn)] getArray def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) rand_N N, Q = getNM() getNM() N def getList():
    return list(map(int, input().split())) def getList():
    return list(map(int, input().split())) getList mod = 10 ** 9 + 7 10 ** 9 + 7 mod def getN():
    return int(input()) def getN():
    return int(input()) getN def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input s, t, x = sec[i] sec[i] s Q = getNM() getNM() Q x = sec[i] sec[i] x def getNM():
    return map(int, input().split()) def getNM():
    return map(int, input().split()) getNM sec = [getList() for i in range(N)] [getList() for i in range(N)] sec def event_sort(section, query):
    s_n = len(section)
    q_n = len(query)
    task = []
    for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q_n):
        task.append((query[i], 2, i))
    task.sort()

    se = set()
    
    ### この問題専用 ###
    res = [-1] * q_n # 答え
    ignore = [-1] * s_n # まだ区間が生きているか
    se_hp = [] # ignoreを元にまだ生きている区間の中でのxの最小値を求める
    heapq.heapify(se_hp)
    ##################

    for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
    return res def event_sort(section, query):
    s_n = len(section)
    q_n = len(query)
    task = []
    for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q_n):
        task.append((query[i], 2, i))
    task.sort()

    se = set()
    
    ### この問題専用 ###
    res = [-1] * q_n # 答え
    ignore = [-1] * s_n # まだ区間が生きているか
    se_hp = [] # ignoreを元にまだ生きている区間の中でのxの最小値を求める
    heapq.heapify(se_hp)
    ##################

    for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
    return res event_sort def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) rand_query query = getArray(Q) getArray(Q) query
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, Q = getNM()
sec = [getList() for i in range(N)]
section = []
for i in range(N):
    s, t, x = sec[i]
    section.append([s - x, t - x])
query = getArray(Q)

# 各queryがどのsectionの開区間[s, t)内にあるか
def event_sort(section, query):
    s_n = len(section)
    q_n = len(query)
    task = []
    for i in range(s_n):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q_n):
        task.append((query[i], 2, i))
    task.sort()

    se = set()
    
    ### この問題専用 ###
    res = [-1] * q_n # 答え
    ignore = [-1] * s_n # まだ区間が生きているか
    se_hp = [] # ignoreを元にまだ生きている区間の中でのxの最小値を求める
    heapq.heapify(se_hp)
    ##################

    for a, b, c in task:
        if b == 1:
            se.remove(c)
            ignore[c] = 1 # これは無視していい
        elif b == 0:
            se.add(c)
            heapq.heappush(se_hp, (sec[c][2], c)) # xの値をsecから引っ張る
        else:
            # 小さい順から抜け殻を捨てて回る
            while se_hp and ignore[se_hp[0][1]] == 1:
                heapq.heappop(se_hp)
            if se_hp:
                res[c] = se_hp[0][0]
            else:
                res[c] = -1
    return res

for i in event_sort(section, query):
    print(i)

"""
# 各queryがどのsectionの開区間[s, t)内にあるか
def event_sort(section, query):
    s = len(section)
    q = len(query)
    # イベント生成
    task = []
    for i in range(s):
        s, t = section[i]
        task.append((s, 0, i))
        task.append((t, 1, i))
    for i in range(q):
        task.append((query[i], 2, i))
    task.sort()

    # 引っかかってる場所の管理
    se = set()

    for a, b, c in task:
        # ゴールが来ると削除
        if b == 1:
            se.remove(c)
        # スタートが来ると追加
        elif b == 0:
            se.add(c)
        # queについてなら
        else:
            print(se)

section = [
[-3, 3],
[-1, 1],
[5, 7],
[1, 2],
]

query = [0, 1, 2, 3]
# [{0, 1}, {0, 3}, {0}, set()]
event_sort(section, query)
"""