import sys
from heapq import heappop,heappush
input = sys.stdin.readline
n,Q = map(int,input().split())
stx = [list(map(int,input().split())) for i in range(n)]
dls = [int(input()) for i in range(Q)]
event = []
for i in range(n):
  s,t,x = stx[i]
  event.append((s-x,1,x))
  event.append((t-x,-1,x))
for i in range(Q):
  d = dls[i]
  event.append((d,2,i))
event.sort()
ans = [-1]*Q
s = set()
hq = []
for t,q,x in event:
  if q == 1:
    s.add(x)
    heappush(hq,x)
  elif q == -1:
    s.remove(x)
  elif q == 2:
    while hq and hq[0] not in s:
      heappop(hq)
    if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1
print(*ans,sep="\n") import sys sys from heapq import heappop,heappush 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 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 stx = [list(map(int,input().split())) for i in range(n)] stx [list(map(int,input().split())) for i in range(n)] int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input dls = [int(input()) for i in range(Q)] dls [int(input()) for i in range(Q)] event = [] event [] for i in range(n):
  s,t,x = stx[i]
  event.append((s-x,1,x))
  event.append((t-x,-1,x)) i range(n) range n s,t,x = stx[i] s stx[i] stx i t x event.append((s-x,1,x)) event.append event append (s-x,1,x) s-x s x 1 x event.append((t-x,-1,x)) event.append event append (t-x,-1,x) t-x t x -1 x for i in range(Q):
  d = dls[i]
  event.append((d,2,i)) i range(Q) range Q d = dls[i] d dls[i] dls i event.append((d,2,i)) event.append event append (d,2,i) d 2 i event.sort() event.sort event sort ans = [-1]*Q ans [-1]*Q [-1] -1 Q s = set() s set() set hq = [] hq [] for t,q,x in event:
  if q == 1:
    s.add(x)
    heappush(hq,x)
  elif q == -1:
    s.remove(x)
  elif q == 2:
    while hq and hq[0] not in s:
      heappop(hq)
    if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1 t q x event if q == 1:
    s.add(x)
    heappush(hq,x)
  elif q == -1:
    s.remove(x)
  elif q == 2:
    while hq and hq[0] not in s:
      heappop(hq)
    if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1 q == 1 q 1 s.add(x) s.add s add x heappush(hq,x) heappush hq x elif q == -1:
    s.remove(x)
   q == -1 q -1 s.remove(x) s.remove s remove x elif q == 2:
    while hq and hq[0] not in s:
      heappop(hq)
    if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1 q == 2 q 2 while hq and hq[0] not in s:
      heappop(hq)
     hq and hq[0] not in s hq hq[0] not in s hq[0] hq 0 s heappop(hq) heappop hq if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1 hq ans[x] = hq[0] ans[x] ans x hq[0] hq 0 ans[x] = -1 ans[x] ans x -1 print(*ans,sep="\n") print *ans ans sep="\n" sep "\n" dls = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] dls stx = [list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] stx n,Q = map(int,input().split()) map(int,input().split()) n d = dls[i] dls[i] d s = set() set() s input = sys.stdin.readline sys.stdin.readline input hq = [] [] hq event = [] [] event Q = map(int,input().split()) map(int,input().split()) Q x = stx[i] stx[i] x ans = [-1]*Q [-1]*Q ans s,t,x = stx[i] stx[i] s t,x = stx[i] stx[i] t
import sys
from heapq import heappop,heappush
input = sys.stdin.readline
n,Q = map(int,input().split())
stx = [list(map(int,input().split())) for i in range(n)]
dls = [int(input()) for i in range(Q)]
event = []
for i in range(n):
  s,t,x = stx[i]
  event.append((s-x,1,x))
  event.append((t-x,-1,x))
for i in range(Q):
  d = dls[i]
  event.append((d,2,i))
event.sort()
ans = [-1]*Q
s = set()
hq = []
for t,q,x in event:
  if q == 1:
    s.add(x)
    heappush(hq,x)
  elif q == -1:
    s.remove(x)
  elif q == 2:
    while hq and hq[0] not in s:
      heappop(hq)
    if hq:
      ans[x] = hq[0]
    else:
      ans[x] = -1
print(*ans,sep="\n")