import sys
from heapq import heappop, heappush

input = sys.stdin.readline
N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

for i in range(Q):
  event_list.append([int(input()), 2, 0])

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

input = sys.stdin.readline
N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

for i in range(Q):
  event_list.append([int(input()), 2, 0])

ans = []
event_list.sort()
x_set = set()
x_list = []
for time, event, x in event_list:
  if event == 1:
    x_set.add(x)
    heappush(x_list, x)
  elif event == -1:
    x_set.remove(x)
  else:
    while x_list and x_list[0] not in x_set:
      heappop(x_list)
    if x_list:
      ans.append(x_list[0])
    else:
      ans.append(-1)

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