from bisect import bisect_left,bisect_right
n,q=map(int,input().split())
w=[list(map(int,input().split()))[::-1]for _ in range(n)]
p=[int(input())for _ in range(q)]
w.sort()
ans=[-1]*q
to=[-1]*q
for x,t,s in w:
  l,r=bisect_left(p,s-x),bisect_left(p,t-x)
  while l<r:
    if to[l]==-1:
      ans[l]=x
      to[l]=r
      l+=1
    else:
      l=to[l]
print(*ans) from bisect import bisect_left,bisect_right n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q list(map(int,input().split()))[::-1]for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int,input().split()))[::-1] (map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ::-1 -1 w=[list(map(int,input().split()))[::-1]for _ in range(n)] w [list(map(int,input().split()))[::-1]for _ in range(n)] int(input())for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input p=[int(input())for _ in range(q)] p [int(input())for _ in range(q)] w.sort() w.sort w sort ans=[-1]*q ans [-1]*q [-1] -1 q to=[-1]*q to [-1]*q [-1] -1 q for x,t,s in w:
  l,r=bisect_left(p,s-x),bisect_left(p,t-x)
  while l<r:
    if to[l]==-1:
      ans[l]=x
      to[l]=r
      l+=1
    else:
      l=to[l] x t s w l,r=bisect_left(p,s-x),bisect_left(p,t-x) l bisect_left(p,s-x) bisect_left p s-x s x r bisect_left(p,t-x) bisect_left p t-x t x while l<r:
    if to[l]==-1:
      ans[l]=x
      to[l]=r
      l+=1
    else:
      l=to[l] l<r l r if to[l]==-1:
      ans[l]=x
      to[l]=r
      l+=1
    else:
      l=to[l] to[l]==-1 to[l] to l -1 ans[l]=x ans[l] ans l x to[l]=r to[l] to l r l+=1 l 1 l=to[l] l to[l] to l print(*ans) print *ans ans l+=1 1 l l,r=bisect_left(p,s-x),bisect_left(p,t-x) bisect_left(p,s-x) l r=bisect_left(p,s-x),bisect_left(p,t-x) bisect_left(p,t-x) r w=[list(map(int,input().split()))[::-1]for _ in range(n)] [list(map(int,input().split()))[::-1]for _ in range(n)] w p=[int(input())for _ in range(q)] [int(input())for _ in range(q)] p ans=[-1]*q [-1]*q ans q=map(int,input().split()) map(int,input().split()) q to=[-1]*q [-1]*q to l=to[l] to[l] l n,q=map(int,input().split()) map(int,input().split()) n
from bisect import bisect_left,bisect_right
n,q=map(int,input().split())
w=[list(map(int,input().split()))[::-1]for _ in range(n)]
p=[int(input())for _ in range(q)]
w.sort()
ans=[-1]*q
to=[-1]*q
for x,t,s in w:
  l,r=bisect_left(p,s-x),bisect_left(p,t-x)
  while l<r:
    if to[l]==-1:
      ans[l]=x
      to[l]=r
      l+=1
    else:
      l=to[l]
print(*ans)