# E - Roadwork
# https://atcoder.jp/contests/abc128/tasks/abc128_e

from heapq import heappop, heappush
from collections import defaultdict

n, q = map(int,input().split())
task = []
for _ in range(n): 
  s, t, x = map(int, input().split())
  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)) 

answer = [-1] * q

task.sort()

se = set()
se_hp = []

for a, b, c in task:
  if b == 0:
    se.remove(c)
  elif b == 1:
    se.add(c)
    heappush(se_hp, c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str, answer))) 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 task = [] task [] for _ in range(n): 
  s, t, x = map(int, input().split())
  task.append((t - x, 0, x)) 
  task.append((s - x, 1, x))  _ 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 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 answer = [-1] * q answer [-1] * q [-1] -1 q task.sort() task.sort task sort se = set() se set() set se_hp = [] se_hp [] for a, b, c in task:
  if b == 0:
    se.remove(c)
  elif b == 1:
    se.add(c)
    heappush(se_hp, c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1 a b c task if b == 0:
    se.remove(c)
  elif b == 1:
    se.add(c)
    heappush(se_hp, c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[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 answer[c] = se_hp[0] if se_hp else -1 answer[c] answer c se_hp[0] if se_hp else -1 se_hp se_hp[0] se_hp 0 -1 print('\n'.join(map(str, answer))) print '\n'.join(map(str, answer)) '\n'.join '\n' join map(str, answer) map str answer x = map(int, input().split()) map(int, input().split()) x q = map(int,input().split()) map(int,input().split()) q se_hp = [] [] se_hp se = set() set() se answer = [-1] * q [-1] * q answer n, q = map(int,input().split()) map(int,input().split()) n task = [] [] task d = int(input()) int(input()) d s, t, x = map(int, input().split()) map(int, input().split()) s t, x = map(int, input().split()) map(int, input().split()) t
# E - Roadwork
# https://atcoder.jp/contests/abc128/tasks/abc128_e

from heapq import heappop, heappush
from collections import defaultdict

n, q = map(int,input().split())
task = []
for _ in range(n): 
  s, t, x = map(int, input().split())
  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)) 

answer = [-1] * q

task.sort()

se = set()
se_hp = []

for a, b, c in task:
  if b == 0:
    se.remove(c)
  elif b == 1:
    se.add(c)
    heappush(se_hp, c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

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