import sys
from heapq import heappush,heappop
input=sys.stdin.readline
n,q=map(int,input().split())
e=[]
for i in range(n):
  s,t,x=map(int,input().split())
  e.append((s-x,1,x))
  e.append((t-x,-1,x))
for i in range(q):
  d=int(input())
  e.append((d,2,0))
e.sort()
s=set()
a=[]
for time_,type_,x_ in e:
  if type_==1:
    s.add(x_)
    heappush(a,x_)
  elif type_==-1:
    s.remove(x_)
  else:
    while a and a[0] not in s:
      heappop(a)
    if a:
      print(a[0])
    else:
      print(-1) import sys sys from heapq import heappush,heappop input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q e=[] e [] for i in range(n):
  s,t,x=map(int,input().split())
  e.append((s-x,1,x))
  e.append((t-x,-1,x)) 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 e.append((s-x,1,x)) e.append e append (s-x,1,x) s-x s x 1 x e.append((t-x,-1,x)) e.append e append (t-x,-1,x) t-x t x -1 x for i in range(q):
  d=int(input())
  e.append((d,2,0)) i range(q) range q d=int(input()) d int(input()) int input() input e.append((d,2,0)) e.append e append (d,2,0) d 2 0 e.sort() e.sort e sort s=set() s set() set a=[] a [] for time_,type_,x_ in e:
  if type_==1:
    s.add(x_)
    heappush(a,x_)
  elif type_==-1:
    s.remove(x_)
  else:
    while a and a[0] not in s:
      heappop(a)
    if a:
      print(a[0])
    else:
      print(-1) time_ type_ x_ e if type_==1:
    s.add(x_)
    heappush(a,x_)
  elif type_==-1:
    s.remove(x_)
  else:
    while a and a[0] not in s:
      heappop(a)
    if a:
      print(a[0])
    else:
      print(-1) type_==1 type_ 1 s.add(x_) s.add s add x_ heappush(a,x_) heappush a x_ elif type_==-1:
    s.remove(x_)
   type_==-1 type_ -1 s.remove(x_) s.remove s remove x_ while a and a[0] not in s:
      heappop(a)
     a and a[0] not in s a a[0] not in s a[0] a 0 s heappop(a) heappop a if a:
      print(a[0])
    else:
      print(-1) a print(a[0]) print a[0] a 0 print(-1) print -1 s=set() set() s a=[] [] a t,x=map(int,input().split()) map(int,input().split()) t x=map(int,input().split()) map(int,input().split()) x e=[] [] e 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 input=sys.stdin.readline sys.stdin.readline input n,q=map(int,input().split()) map(int,input().split()) n
import sys
from heapq import heappush,heappop
input=sys.stdin.readline
n,q=map(int,input().split())
e=[]
for i in range(n):
  s,t,x=map(int,input().split())
  e.append((s-x,1,x))
  e.append((t-x,-1,x))
for i in range(q):
  d=int(input())
  e.append((d,2,0))
e.sort()
s=set()
a=[]
for time_,type_,x_ in e:
  if type_==1:
    s.add(x_)
    heappush(a,x_)
  elif type_==-1:
    s.remove(x_)
  else:
    while a and a[0] not in s:
      heappop(a)
    if a:
      print(a[0])
    else:
      print(-1)