import sys
input = sys.stdin.buffer.readline
n,q=map(int,input().split())
import heapq
S=[]
D=dict()
for i in range(n):
  s,t,x=map(int,input().split())
  S.append((1,x,max(0,s-x)))
  S.append((-1,x,max(0,t-x)))
  D[x]=False
S.sort(key=lambda x:x[2])
X=[]
cur=0
for i in range(q):
  d=int(input())
  while cur<2*n:
    a,b,c=S[cur]
    if c>d:
      break
    else:
      cur+=1
      if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
  while X:
    ans=heapq.heappop(X)
    if D[ans]:
      print(ans)
      heapq.heappush(X,ans)
      break
  if not X:
    print(-1) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q import heapq heapq S=[] S [] D=dict() D dict() dict for i in range(n):
  s,t,x=map(int,input().split())
  S.append((1,x,max(0,s-x)))
  S.append((-1,x,max(0,t-x)))
  D[x]=False i 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 S.append((1,x,max(0,s-x))) S.append S append (1,x,max(0,s-x)) 1 x max(0,s-x) max 0 s-x s x S.append((-1,x,max(0,t-x))) S.append S append (-1,x,max(0,t-x)) -1 x max(0,t-x) max 0 t-x t x D[x]=False D[x] D x False S.sort(key=lambda x:x[2]) S.sort S sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x X=[] X [] cur=0 cur 0 for i in range(q):
  d=int(input())
  while cur<2*n:
    a,b,c=S[cur]
    if c>d:
      break
    else:
      cur+=1
      if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
  while X:
    ans=heapq.heappop(X)
    if D[ans]:
      print(ans)
      heapq.heappush(X,ans)
      break
  if not X:
    print(-1) i range(q) range q d=int(input()) d int(input()) int input() input while cur<2*n:
    a,b,c=S[cur]
    if c>d:
      break
    else:
      cur+=1
      if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
   cur<2*n cur 2*n 2 n a,b,c=S[cur] a S[cur] S cur b c if c>d:
      break
    else:
      cur+=1
      if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
   c>d c d break cur+=1 cur 1 if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
   a==1 a 1 heapq.heappush(X,b) heapq.heappush heapq heappush X b D[b]=True D[b] D b True D[b]=False D[b] D b False while X:
    ans=heapq.heappop(X)
    if D[ans]:
      print(ans)
      heapq.heappush(X,ans)
      break
   X ans=heapq.heappop(X) ans heapq.heappop(X) heapq.heappop heapq heappop X if D[ans]:
      print(ans)
      heapq.heappush(X,ans)
      break
   D[ans] D ans print(ans) print ans heapq.heappush(X,ans) heapq.heappush heapq heappush X ans break if not X:
    print(-1) not X X print(-1) print -1 t,x=map(int,input().split()) map(int,input().split()) t s,t,x=map(int,input().split()) map(int,input().split()) s q=map(int,input().split()) map(int,input().split()) q d=int(input()) int(input()) d cur+=1 1 cur a,b,c=S[cur] S[cur] a input = sys.stdin.buffer.readline sys.stdin.buffer.readline input D=dict() dict() D b,c=S[cur] S[cur] b c=S[cur] S[cur] c n,q=map(int,input().split()) map(int,input().split()) n X=[] [] X x=map(int,input().split()) map(int,input().split()) x cur=0 0 cur S=[] [] S ans=heapq.heappop(X) heapq.heappop(X) ans
import sys
input = sys.stdin.buffer.readline
n,q=map(int,input().split())
import heapq
S=[]
D=dict()
for i in range(n):
  s,t,x=map(int,input().split())
  S.append((1,x,max(0,s-x)))
  S.append((-1,x,max(0,t-x)))
  D[x]=False
S.sort(key=lambda x:x[2])
X=[]
cur=0
for i in range(q):
  d=int(input())
  while cur<2*n:
    a,b,c=S[cur]
    if c>d:
      break
    else:
      cur+=1
      if a==1:
        heapq.heappush(X,b)
        D[b]=True
      else:
        D[b]=False
  while X:
    ans=heapq.heappop(X)
    if D[ans]:
      print(ans)
      heapq.heappush(X,ans)
      break
  if not X:
    print(-1)
