import sys
input = sys.stdin.readline
from heapq import heappop,heappush

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
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))
answer = [-1]*Q

task.sort()

se = set()
se_hp = []
for a,b,c in task:
  if not b:
    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)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer))) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from heapq import heappop,heappush N,Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q task = [] task [] [int(x) for x in input().split()] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [int(x) for x in input().split()] STX = [[int(x) for x in input().split()] for _ in range(N)] STX [[int(x) for x in input().split()] for _ in range(N)] 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 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 not b:
    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)
    answer[c] = se_hp[0] if se_hp else -1 a b c task if not b:
    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)
    answer[c] = se_hp[0] if se_hp else -1 not b b 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 answer = [-1]*Q [-1]*Q answer input = sys.stdin.readline sys.stdin.readline input task = [] [] task se_hp = [] [] se_hp STX = [[int(x) for x in input().split()] for _ in range(N)] [[int(x) for x in input().split()] for _ in range(N)] STX N,Q = map(int,input().split()) map(int,input().split()) N Q = map(int,input().split()) map(int,input().split()) Q se = set() set() se d = int(input()) int(input()) d
import sys
input = sys.stdin.readline
from heapq import heappop,heappush

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
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))
answer = [-1]*Q

task.sort()

se = set()
se_hp = []
for a,b,c in task:
  if not b:
    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)
    answer[c] = se_hp[0] if se_hp else -1

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