import sys
from bisect import bisect_left
input = sys.stdin.readline

N,Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

STX = sorted(STX, key=lambda x: x[2])

MASK = [-1]*Q
ANS = [-1]*Q

for (s,t,x) in STX:
  s2 = (s - x)
  t2 = (t - x)

  start = bisect_left(D, s2)
  end = bisect_left(D, t2, lo=start)

  #print(start, end, DI)
  while (start < end):
    if (-1 == MASK[start]):
      ANS[start] = x
      MASK[start] = end
      start += 1
    else:
      start = MASK[start]


print(*ANS, sep='\n') import sys sys from bisect import bisect_left 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 _ 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 STX = [list(map(int, input().split())) for _ in range(N)] STX [list(map(int, input().split())) for _ in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] STX = sorted(STX, key=lambda x: x[2]) STX sorted(STX, key=lambda x: x[2]) sorted STX key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x MASK = [-1]*Q MASK [-1]*Q [-1] -1 Q ANS = [-1]*Q ANS [-1]*Q [-1] -1 Q for (s,t,x) in STX:
  s2 = (s - x)
  t2 = (t - x)

  start = bisect_left(D, s2)
  end = bisect_left(D, t2, lo=start)

  #print(start, end, DI)
  while (start < end):
    if (-1 == MASK[start]):
      ANS[start] = x
      MASK[start] = end
      start += 1
    else:
      start = MASK[start] (s,t,x) s t x STX s2 = (s - x) s2 s - x s x t2 = (t - x) t2 t - x t x start = bisect_left(D, s2) start bisect_left(D, s2) bisect_left D s2 end = bisect_left(D, t2, lo=start) end bisect_left(D, t2, lo=start) bisect_left D t2 lo=start lo start while (start < end):
    if (-1 == MASK[start]):
      ANS[start] = x
      MASK[start] = end
      start += 1
    else:
      start = MASK[start] start < end start end if (-1 == MASK[start]):
      ANS[start] = x
      MASK[start] = end
      start += 1
    else:
      start = MASK[start] -1 == MASK[start] -1 MASK[start] MASK start ANS[start] = x ANS[start] ANS start x MASK[start] = end MASK[start] MASK start end start += 1 start 1 start = MASK[start] start MASK[start] MASK start print(*ANS, sep='\n') print *ANS ANS sep='\n' sep '\n' MASK = [-1]*Q [-1]*Q MASK start += 1 1 start s2 = (s - x) s - x s2 Q = map(int, input().split()) map(int, input().split()) Q STX = sorted(STX, key=lambda x: x[2]) sorted(STX, key=lambda x: x[2]) STX t2 = (t - x) t - x t2 STX = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] STX ANS = [-1]*Q [-1]*Q ANS D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D end = bisect_left(D, t2, lo=start) bisect_left(D, t2, lo=start) end start = bisect_left(D, s2) bisect_left(D, s2) start input = sys.stdin.readline sys.stdin.readline input N,Q = map(int, input().split()) map(int, input().split()) N start = MASK[start] MASK[start] start
import sys
from bisect import bisect_left
input = sys.stdin.readline

N,Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

STX = sorted(STX, key=lambda x: x[2])

MASK = [-1]*Q
ANS = [-1]*Q

for (s,t,x) in STX:
  s2 = (s - x)
  t2 = (t - x)

  start = bisect_left(D, s2)
  end = bisect_left(D, t2, lo=start)

  #print(start, end, DI)
  while (start < end):
    if (-1 == MASK[start]):
      ANS[start] = x
      MASK[start] = end
      start += 1
    else:
      start = MASK[start]


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