import heapq as hq
from collections import defaultdict
N, Q = map(int, input().split())
event = []
for i in range(N):
    si, ti, xi = map(int, input().split())
    event.append([si - xi, ti - xi, xi])
#STX = [list(map(int, input().split())) for i in range(N)]
Dlist = [int(input()) for i in range(Q)]
#for s,t,x in STX:
#    event.append([s - x, t-x, x])
event.sort(key=lambda x:x[0])
h = []
tdic = defaultdict(int)
ind = 0
for Di in Dlist:
    while ind<N and event[ind][0] <= Di:
        #Diまでに始まった工事を追加
        hq.heappush(h, event[ind][2])
        tdic[event[ind][2]] = event[ind][1]
        ind += 1
    while h and Di >= tdic[h[0]]:
        #Diまでに終わった工事を削除
        hq.heappop(h)
    if h:
        print(h[0])
    else:
        print(-1) import heapq as hq heapq from collections import defaultdict N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q event = [] event [] for i in range(N):
    si, ti, xi = map(int, input().split())
    event.append([si - xi, ti - xi, xi])
#STX = [list(map(int, input().split())) for i in range(N)] i range(N) range N si, ti, xi = map(int, input().split()) si map(int, input().split()) map int input().split() ().split () input split ti xi event.append([si - xi, ti - xi, xi]) event.append event append [si - xi, ti - xi, xi] si - xi si xi ti - xi ti xi xi 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 Dlist = [int(input()) for i in range(Q)] Dlist [int(input()) for i in range(Q)] event.sort(key=lambda x:x[0]) event.sort event sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x h = [] h [] tdic = defaultdict(int) tdic defaultdict(int) defaultdict int ind = 0 ind 0 for Di in Dlist:
    while ind<N and event[ind][0] <= Di:
        #Diまでに始まった工事を追加
        hq.heappush(h, event[ind][2])
        tdic[event[ind][2]] = event[ind][1]
        ind += 1
    while h and Di >= tdic[h[0]]:
        #Diまでに終わった工事を削除
        hq.heappop(h)
    if h:
        print(h[0])
    else:
        print(-1) Di Dlist while ind<N and event[ind][0] <= Di:
        #Diまでに始まった工事を追加
        hq.heappush(h, event[ind][2])
        tdic[event[ind][2]] = event[ind][1]
        ind += 1
     ind<N and event[ind][0] <= Di ind<N ind N event[ind][0] <= Di event[ind][0] [ind] event ind 0 Di hq.heappush(h, event[ind][2]) hq.heappush hq heappush h event[ind][2] [ind] event ind 2 tdic[event[ind][2]] = event[ind][1] tdic[event[ind][2]] tdic event[ind][2] [ind] event ind 2 event[ind][1] [ind] event ind 1 ind += 1 ind 1 while h and Di >= tdic[h[0]]:
        #Diまでに終わった工事を削除
        hq.heappop(h)
     h and Di >= tdic[h[0]] h Di >= tdic[h[0]] Di tdic[h[0]] tdic h[0] h 0 hq.heappop(h) hq.heappop hq heappop h if h:
        print(h[0])
    else:
        print(-1) h print(h[0]) print h[0] h 0 print(-1) print -1 Q = map(int, input().split()) map(int, input().split()) Q si, ti, xi = map(int, input().split()) map(int, input().split()) si h = [] [] h ti, xi = map(int, input().split()) map(int, input().split()) ti ind += 1 1 ind event = [] [] event tdic = defaultdict(int) defaultdict(int) tdic N, Q = map(int, input().split()) map(int, input().split()) N xi = map(int, input().split()) map(int, input().split()) xi ind = 0 0 ind Dlist = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] Dlist
import heapq as hq
from collections import defaultdict
N, Q = map(int, input().split())
event = []
for i in range(N):
    si, ti, xi = map(int, input().split())
    event.append([si - xi, ti - xi, xi])
#STX = [list(map(int, input().split())) for i in range(N)]
Dlist = [int(input()) for i in range(Q)]
#for s,t,x in STX:
#    event.append([s - x, t-x, x])
event.sort(key=lambda x:x[0])
h = []
tdic = defaultdict(int)
ind = 0
for Di in Dlist:
    while ind<N and event[ind][0] <= Di:
        #Diまでに始まった工事を追加
        hq.heappush(h, event[ind][2])
        tdic[event[ind][2]] = event[ind][1]
        ind += 1
    while h and Di >= tdic[h[0]]:
        #Diまでに終わった工事を削除
        hq.heappop(h)
    if h:
        print(h[0])
    else:
        print(-1)