from bisect import bisect_left

n,q=map(int,input().split())
work=[list(map(int,input().split())) for _ in range(n)]
work=sorted(work,key=lambda x:x[2])
pos=[int(input()) for _ in range(q)]
ans=[-1]*q
checked=[-1]*q
for s,t,x in work:
  l=bisect_left(pos,s-x)
  r=bisect_left(pos,t-x)
  while l<r:
    if checked[l]==-1:
      checked[l]=r
      ans[l]=x
      l+=1
    else:
      l=checked[l]
for i in ans:
  print(i) from bisect import bisect_left n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q list(map(int,input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split work=[list(map(int,input().split())) for _ in range(n)] work [list(map(int,input().split())) for _ in range(n)] work=sorted(work,key=lambda x:x[2]) work sorted(work,key=lambda x:x[2]) sorted work key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input pos=[int(input()) for _ in range(q)] pos [int(input()) for _ in range(q)] ans=[-1]*q ans [-1]*q [-1] -1 q checked=[-1]*q checked [-1]*q [-1] -1 q for s,t,x in work:
  l=bisect_left(pos,s-x)
  r=bisect_left(pos,t-x)
  while l<r:
    if checked[l]==-1:
      checked[l]=r
      ans[l]=x
      l+=1
    else:
      l=checked[l] s t x work l=bisect_left(pos,s-x) l bisect_left(pos,s-x) bisect_left pos s-x s x r=bisect_left(pos,t-x) r bisect_left(pos,t-x) bisect_left pos t-x t x while l<r:
    if checked[l]==-1:
      checked[l]=r
      ans[l]=x
      l+=1
    else:
      l=checked[l] l<r l r if checked[l]==-1:
      checked[l]=r
      ans[l]=x
      l+=1
    else:
      l=checked[l] checked[l]==-1 checked[l] checked l -1 checked[l]=r checked[l] checked l r ans[l]=x ans[l] ans l x l+=1 l 1 l=checked[l] l checked[l] checked l for i in ans:
  print(i) i ans print(i) print i checked=[-1]*q [-1]*q checked pos=[int(input()) for _ in range(q)] [int(input()) for _ in range(q)] pos ans=[-1]*q [-1]*q ans q=map(int,input().split()) map(int,input().split()) q work=[list(map(int,input().split())) for _ in range(n)] [list(map(int,input().split())) for _ in range(n)] work l=bisect_left(pos,s-x) bisect_left(pos,s-x) l r=bisect_left(pos,t-x) bisect_left(pos,t-x) r l=checked[l] checked[l] l n,q=map(int,input().split()) map(int,input().split()) n l+=1 1 l work=sorted(work,key=lambda x:x[2]) sorted(work,key=lambda x:x[2]) work
from bisect import bisect_left

n,q=map(int,input().split())
work=[list(map(int,input().split())) for _ in range(n)]
work=sorted(work,key=lambda x:x[2])
pos=[int(input()) for _ in range(q)]
ans=[-1]*q
checked=[-1]*q
for s,t,x in work:
  l=bisect_left(pos,s-x)
  r=bisect_left(pos,t-x)
  while l<r:
    if checked[l]==-1:
      checked[l]=r
      ans[l]=x
      l+=1
    else:
      l=checked[l]
for i in ans:
  print(i)