import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')
 import sys sys from heapq import heappush, heappop n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q (s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),) _ range(n) range n for s, t, x in (map(int, sys.stdin.readline().split()),) s t x map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for s, t, x in (map(int, sys.stdin.readline().split()),) (s-x, t-x, x) s-x s x t-x t x x a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True) a sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True) sorted ((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)) reverse=True reverse True heap=[] heap [] ans=[] ans [] z=list(map(int,sys.stdin)) z list(map(int,sys.stdin)) list map(int,sys.stdin) map int sys.stdin sys stdin for d in z:
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1) d z while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
   a and a[-1][0]<=d a a[-1][0]<=d a[-1][0] [-1] a -1 0 d e=a.pop() e a.pop() a.pop a pop heappush(heap,(e[2],e[1])) heappush heap (e[2],e[1]) e[2] e 2 e[1] e 1 while heap and heap[0][1]<=d:
    heappop(heap)
   heap and heap[0][1]<=d heap heap[0][1]<=d heap[0][1] [0] heap 0 1 d heappop(heap) heappop heap if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1) heap ans.append(heap[0][0]) ans.append ans append heap[0][0] [0] heap 0 0 ans.append(-1) ans.append ans append -1 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' e=a.pop() a.pop() e ans=[] [] ans n,q=map(int,input().split()) map(int,input().split()) n q=map(int,input().split()) map(int,input().split()) q a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True) sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True) a heap=[] [] heap z=list(map(int,sys.stdin)) list(map(int,sys.stdin)) z
import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')

