from bisect import bisect_left as bl
N, Q = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
X.sort(key = lambda x: x[2])
Y = [int(input()) for _ in range(Q)]
res = [-1] * Q
jump = [-1] * Q
for s,t,x in X:
  l=bl(Y,s - x)
  r=bl(Y,t - x)
  while l < r:
    s = jump[l]
    if s == -1:
      res[l] = x
      jump[l] = r
      l += 1
    else:
      l = s
print(*res,sep = '\n') from bisect import bisect_left as bl 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 _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split X = [list(map(int, input().split())) for _ in range(N)] X [list(map(int, input().split())) for _ in range(N)] X.sort(key = lambda x: x[2]) X.sort X sort key = lambda x: x[2] key lambda x: x[2] x[2] x 2 x int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input Y = [int(input()) for _ in range(Q)] Y [int(input()) for _ in range(Q)] res = [-1] * Q res [-1] * Q [-1] -1 Q jump = [-1] * Q jump [-1] * Q [-1] -1 Q for s,t,x in X:
  l=bl(Y,s - x)
  r=bl(Y,t - x)
  while l < r:
    s = jump[l]
    if s == -1:
      res[l] = x
      jump[l] = r
      l += 1
    else:
      l = s s t x X l=bl(Y,s - x) l bl(Y,s - x) bl Y s - x s x r=bl(Y,t - x) r bl(Y,t - x) bl Y t - x t x while l < r:
    s = jump[l]
    if s == -1:
      res[l] = x
      jump[l] = r
      l += 1
    else:
      l = s l < r l r s = jump[l] s jump[l] jump l if s == -1:
      res[l] = x
      jump[l] = r
      l += 1
    else:
      l = s s == -1 s -1 res[l] = x res[l] res l x jump[l] = r jump[l] jump l r l += 1 l 1 l = s l s print(*res,sep = '\n') print *res res sep = '\n' sep '\n' Q = map(int, input().split()) map(int, input().split()) Q r=bl(Y,t - x) bl(Y,t - x) r l = s s l res = [-1] * Q [-1] * Q res N, Q = map(int, input().split()) map(int, input().split()) N s = jump[l] jump[l] s l=bl(Y,s - x) bl(Y,s - x) l l += 1 1 l Y = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] Y jump = [-1] * Q [-1] * Q jump X = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] X
from bisect import bisect_left as bl
N, Q = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
X.sort(key = lambda x: x[2])
Y = [int(input()) for _ in range(Q)]
res = [-1] * Q
jump = [-1] * Q
for s,t,x in X:
  l=bl(Y,s - x)
  r=bl(Y,t - x)
  while l < r:
    s = jump[l]
    if s == -1:
      res[l] = x
      jump[l] = r
      l += 1
    else:
      l = s
print(*res,sep = '\n')