import heapq
N,Q = map(int, input().split())

S,T,X = [],[],[]

Ev = []
for _ in range(N):
  s,t,x = map(int, input().split())
  Ev.append((s-x,True,x))
  Ev.append((t-x,False,x))
"""
2 5 6
5 -1
4 2
3 3
2 4
1 5
0 -1
"""
Ev.sort()
#print(Ev)
# C++のSetはminもO(logN)で取れるが、Pythonは無理。
# setとheapqを併用すると計算量が実現できる。
h = []
closed = set()
eidx = 0
for i in range(Q):
  # dはsortedでinputされる。
  d = int(input())
  #Query.append(d)
  while eidx < 2*N and Ev[eidx][0] <= d:
    #pop
    t,e,x = Ev[eidx]
    eidx += 1
    if e:
      heapq.heappush(h, x)
      closed.add(x)
    else:
      closed.remove(x)
      
  # heqpqの最小値がsetに含まれている間、捨て続ければ、setの要素とheapqの要素が一致する
  while h and h[0] not in closed:
    heapq.heappop(h)
    
  # assert( len(h) == len(set) )
  if h:
    print(h[0])
  else:
    print(-1) import heapq heapq N,Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q S,T,X = [],[],[] S [] T [] X [] Ev = [] Ev [] for _ in range(N):
  s,t,x = map(int, input().split())
  Ev.append((s-x,True,x))
  Ev.append((t-x,False,x)) _ 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 Ev.append((s-x,True,x)) Ev.append Ev append (s-x,True,x) s-x s x True x Ev.append((t-x,False,x)) Ev.append Ev append (t-x,False,x) t-x t x False x """
2 5 6
5 -1
4 2
3 3
2 4
1 5
0 -1
""" Ev.sort() Ev.sort Ev sort h = [] h [] closed = set() closed set() set eidx = 0 eidx 0 for i in range(Q):
  # dはsortedでinputされる。
  d = int(input())
  #Query.append(d)
  while eidx < 2*N and Ev[eidx][0] <= d:
    #pop
    t,e,x = Ev[eidx]
    eidx += 1
    if e:
      heapq.heappush(h, x)
      closed.add(x)
    else:
      closed.remove(x)
      
  # heqpqの最小値がsetに含まれている間、捨て続ければ、setの要素とheapqの要素が一致する
  while h and h[0] not in closed:
    heapq.heappop(h)
    
  # assert( len(h) == len(set) )
  if h:
    print(h[0])
  else:
    print(-1) i range(Q) range Q d = int(input()) d int(input()) int input() input while eidx < 2*N and Ev[eidx][0] <= d:
    #pop
    t,e,x = Ev[eidx]
    eidx += 1
    if e:
      heapq.heappush(h, x)
      closed.add(x)
    else:
      closed.remove(x)
      
  # heqpqの最小値がsetに含まれている間、捨て続ければ、setの要素とheapqの要素が一致する
   eidx < 2*N and Ev[eidx][0] <= d eidx < 2*N eidx 2*N 2 N Ev[eidx][0] <= d Ev[eidx][0] [eidx] Ev eidx 0 d t,e,x = Ev[eidx] t Ev[eidx] Ev eidx e x eidx += 1 eidx 1 if e:
      heapq.heappush(h, x)
      closed.add(x)
    else:
      closed.remove(x)
      
  # heqpqの最小値がsetに含まれている間、捨て続ければ、setの要素とheapqの要素が一致する
   e heapq.heappush(h, x) heapq.heappush heapq heappush h x closed.add(x) closed.add closed add x closed.remove(x) closed.remove closed remove x while h and h[0] not in closed:
    heapq.heappop(h)
    
  # assert( len(h) == len(set) )
   h and h[0] not in closed h h[0] not in closed h[0] h 0 closed heapq.heappop(h) heapq.heappop heapq heappop h if h:
    print(h[0])
  else:
    print(-1) h print(h[0]) print h[0] h 0 print(-1) print -1 h = [] [] h t,e,x = Ev[eidx] Ev[eidx] t N,Q = map(int, input().split()) map(int, input().split()) N Ev = [] [] Ev eidx += 1 1 eidx eidx = 0 0 eidx S,T,X = [],[],[] [] S e,x = Ev[eidx] Ev[eidx] e Q = map(int, input().split()) map(int, input().split()) Q x = Ev[eidx] Ev[eidx] x x = map(int, input().split()) map(int, input().split()) x closed = set() set() closed T,X = [],[],[] [] T s,t,x = map(int, input().split()) map(int, input().split()) s d = int(input()) int(input()) d t,x = map(int, input().split()) map(int, input().split()) t X = [],[],[] [] X
import heapq
N,Q = map(int, input().split())

S,T,X = [],[],[]

Ev = []
for _ in range(N):
  s,t,x = map(int, input().split())
  Ev.append((s-x,True,x))
  Ev.append((t-x,False,x))
"""
2 5 6
5 -1
4 2
3 3
2 4
1 5
0 -1
"""
Ev.sort()
#print(Ev)
# C++のSetはminもO(logN)で取れるが、Pythonは無理。
# setとheapqを併用すると計算量が実現できる。
h = []
closed = set()
eidx = 0
for i in range(Q):
  # dはsortedでinputされる。
  d = int(input())
  #Query.append(d)
  while eidx < 2*N and Ev[eidx][0] <= d:
    #pop
    t,e,x = Ev[eidx]
    eidx += 1
    if e:
      heapq.heappush(h, x)
      closed.add(x)
    else:
      closed.remove(x)
      
  # heqpqの最小値がsetに含まれている間、捨て続ければ、setの要素とheapqの要素が一致する
  while h and h[0] not in closed:
    heapq.heappop(h)
    
  # assert( len(h) == len(set) )
  if h:
    print(h[0])
  else:
    print(-1)
