import sys
input = sys.stdin.readline
read = sys.stdin.read
import heapq

n, q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(n)]
D = list(map(int, read().split()))
E = []
for s, t, x in STX:
  E.append((s-x, x, 1))
  E.append((t-x, x, 0))
E.sort(reverse=True)
que = []
stop = set()
que.append(10**10)
stop.add(10**10)
for d in D:
  while E and E[-1][0] <= d:
    temp, x, f = E.pop()
    if f:
      heapq.heappush(que, x)
      stop.add(x)
    else:
      stop.remove(x)
  while que[0] not in stop:
    heapq.heappop(que)
  if que[0] == 10**10:
    print(-1)
  else:
    print(que[0]) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read import heapq heapq 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)] D = list(map(int, read().split())) D list(map(int, read().split())) list map(int, read().split()) map int read().split() ().split () read split E = [] E [] for s, t, x in STX:
  E.append((s-x, x, 1))
  E.append((t-x, x, 0)) s t x STX E.append((s-x, x, 1)) E.append E append (s-x, x, 1) s-x s x x 1 E.append((t-x, x, 0)) E.append E append (t-x, x, 0) t-x t x x 0 E.sort(reverse=True) E.sort E sort reverse=True reverse True que = [] que [] stop = set() stop set() set que.append(10**10) que.append que append 10**10 10 10 stop.add(10**10) stop.add stop add 10**10 10 10 for d in D:
  while E and E[-1][0] <= d:
    temp, x, f = E.pop()
    if f:
      heapq.heappush(que, x)
      stop.add(x)
    else:
      stop.remove(x)
  while que[0] not in stop:
    heapq.heappop(que)
  if que[0] == 10**10:
    print(-1)
  else:
    print(que[0]) d D while E and E[-1][0] <= d:
    temp, x, f = E.pop()
    if f:
      heapq.heappush(que, x)
      stop.add(x)
    else:
      stop.remove(x)
   E and E[-1][0] <= d E E[-1][0] <= d E[-1][0] [-1] E -1 0 d temp, x, f = E.pop() temp E.pop() E.pop E pop x f if f:
      heapq.heappush(que, x)
      stop.add(x)
    else:
      stop.remove(x)
   f heapq.heappush(que, x) heapq.heappush heapq heappush que x stop.add(x) stop.add stop add x stop.remove(x) stop.remove stop remove x while que[0] not in stop:
    heapq.heappop(que)
   que[0] not in stop que[0] que 0 stop heapq.heappop(que) heapq.heappop heapq heappop que if que[0] == 10**10:
    print(-1)
  else:
    print(que[0]) que[0] == 10**10 que[0] que 0 10**10 10 10 print(-1) print -1 print(que[0]) print que[0] que 0 read = sys.stdin.read sys.stdin.read read temp, x, f = E.pop() E.pop() temp que = [] [] que f = E.pop() E.pop() f STX = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] STX stop = set() set() stop x, f = E.pop() E.pop() x n, q = map(int, input().split()) map(int, input().split()) n q = map(int, input().split()) map(int, input().split()) q E = [] [] E D = list(map(int, read().split())) list(map(int, read().split())) D input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline
read = sys.stdin.read
import heapq

n, q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(n)]
D = list(map(int, read().split()))
E = []
for s, t, x in STX:
  E.append((s-x, x, 1))
  E.append((t-x, x, 0))
E.sort(reverse=True)
que = []
stop = set()
que.append(10**10)
stop.add(10**10)
for d in D:
  while E and E[-1][0] <= d:
    temp, x, f = E.pop()
    if f:
      heapq.heappush(que, x)
      stop.add(x)
    else:
      stop.remove(x)
  while que[0] not in stop:
    heapq.heappop(que)
  if que[0] == 10**10:
    print(-1)
  else:
    print(que[0])