import sys
input=sys.stdin.readline
import heapq
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
L1=[]
for i in range(n):
  L1.append((l[i][0]-l[i][2],1,l[i][2]))
  L1.append((l[i][1]-l[i][2],-1,l[i][2]))
for i in range(q):
  L1.append((int(input()),2,0))
L1.sort()
L2=[]
heapq.heapify(L2)
L3=[]
L3=set(L3)
for i in range(len(L1)):
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import heapq heapq 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 i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l=[list(map(int,input().split())) for i in range(n)] l [list(map(int,input().split())) for i in range(n)] L1=[] L1 [] for i in range(n):
  L1.append((l[i][0]-l[i][2],1,l[i][2]))
  L1.append((l[i][1]-l[i][2],-1,l[i][2])) i range(n) range n L1.append((l[i][0]-l[i][2],1,l[i][2])) L1.append L1 append (l[i][0]-l[i][2],1,l[i][2]) l[i][0]-l[i][2] l[i][0] [i] l i 0 l[i][2] [i] l i 2 1 l[i][2] [i] l i 2 L1.append((l[i][1]-l[i][2],-1,l[i][2])) L1.append L1 append (l[i][1]-l[i][2],-1,l[i][2]) l[i][1]-l[i][2] l[i][1] [i] l i 1 l[i][2] [i] l i 2 -1 l[i][2] [i] l i 2 for i in range(q):
  L1.append((int(input()),2,0)) i range(q) range q L1.append((int(input()),2,0)) L1.append L1 append (int(input()),2,0) int(input()) int input() input 2 0 L1.sort() L1.sort L1 sort L2=[] L2 [] heapq.heapify(L2) heapq.heapify heapq heapify L2 L3=[] L3 [] L3=set(L3) L3 set(L3) set L3 for i in range(len(L1)):
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1) i range(len(L1)) range len(L1) len L1 if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1) L1[i][1]==1 L1[i][1] [i] L1 i 1 1 heapq.heappush(L2,L1[i][2]) heapq.heappush heapq heappush L2 L1[i][2] [i] L1 i 2 L3.add(L1[i][2]) L3.add L3 add L1[i][2] [i] L1 i 2 elif L1[i][1]==-1:
    L3.remove(L1[i][2])
   L1[i][1]==-1 L1[i][1] [i] L1 i 1 -1 L3.remove(L1[i][2]) L3.remove L3 remove L1[i][2] [i] L1 i 2 while L2 and L2[0] not in L3:
      heapq.heappop(L2)
     L2 and L2[0] not in L3 L2 L2[0] not in L3 L2[0] L2 0 L3 heapq.heappop(L2) heapq.heappop heapq heappop L2 if L2:
      print(L2[0])
    else:
      print(-1) L2 print(L2[0]) print L2[0] L2 0 print(-1) print -1 L2=[] [] L2 l=[list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] l L1=[] [] L1 L3=[] [] L3 n,q=map(int,input().split()) map(int,input().split()) n input=sys.stdin.readline sys.stdin.readline input L3=set(L3) set(L3) L3 q=map(int,input().split()) map(int,input().split()) q
import sys
input=sys.stdin.readline
import heapq
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
L1=[]
for i in range(n):
  L1.append((l[i][0]-l[i][2],1,l[i][2]))
  L1.append((l[i][1]-l[i][2],-1,l[i][2]))
for i in range(q):
  L1.append((int(input()),2,0))
L1.sort()
L2=[]
heapq.heapify(L2)
L3=[]
L3=set(L3)
for i in range(len(L1)):
  if L1[i][1]==1:
    heapq.heappush(L2,L1[i][2])
    L3.add(L1[i][2])
  elif L1[i][1]==-1:
    L3.remove(L1[i][2])
  else:
    while L2 and L2[0] not in L3:
      heapq.heappop(L2)
    if L2:
      print(L2[0])
    else:
      print(-1)