import heapq
import sys
input=sys.stdin.readline

N,Q = map(int,input().split(" "))
querys = []
START = 1
GOAL = 0
GO = 2

for _ in range(N):
    s,t,x = (map(int,input().split(" ")))
    s -=(x + 0.5)
    t -= (x + 0.5)
    querys.append( (s,START,x) )
    querys.append( (t,GOAL,x) )

for _ in range(Q):

    querys.append( (int(input()),GO,-1)  )
koji_place = []
koji_um = set([])
heapq.heapify(koji_place)
querys.sort()
for query in querys:
    time,qtype,place = query
    if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    else:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if not koji_place:
            print(-1)
        else:
            print(koji_place[0])


 import heapq heapq import sys sys 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 querys = [] querys [] START = 1 START 1 GOAL = 0 GOAL 0 GO = 2 GO 2 for _ in range(N):
    s,t,x = (map(int,input().split(" ")))
    s -=(x + 0.5)
    t -= (x + 0.5)
    querys.append( (s,START,x) )
    querys.append( (t,GOAL,x) ) _ 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 s -=(x + 0.5) s x + 0.5 x 0.5 t -= (x + 0.5) t x + 0.5 x 0.5 querys.append( (s,START,x) ) querys.append querys append (s,START,x) s START x querys.append( (t,GOAL,x) ) querys.append querys append (t,GOAL,x) t GOAL x for _ in range(Q):

    querys.append( (int(input()),GO,-1)  ) _ range(Q) range Q querys.append( (int(input()),GO,-1)  ) querys.append querys append (int(input()),GO,-1) int(input()) int input() input GO -1 koji_place = [] koji_place [] koji_um = set([]) koji_um set([]) set [] heapq.heapify(koji_place) heapq.heapify heapq heapify koji_place querys.sort() querys.sort querys sort for query in querys:
    time,qtype,place = query
    if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    else:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if not koji_place:
            print(-1)
        else:
            print(koji_place[0]) query querys time,qtype,place = query time query qtype place if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    else:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if not koji_place:
            print(-1)
        else:
            print(koji_place[0]) qtype == START qtype START heapq.heappush(koji_place,place) heapq.heappush heapq heappush koji_place place koji_um.add(place) koji_um.add koji_um add place elif qtype == GOAL:
        koji_um.remove(place)
     qtype == GOAL qtype GOAL koji_um.remove(place) koji_um.remove koji_um remove place while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
         koji_place and koji_place[0] not in koji_um koji_place koji_place[0] not in koji_um koji_place[0] koji_place 0 koji_um heapq.heappop(koji_place) heapq.heappop heapq heappop koji_place if not koji_place:
            print(-1)
        else:
            print(koji_place[0]) not koji_place koji_place print(-1) print -1 print(koji_place[0]) print koji_place[0] koji_place 0 t,x = (map(int,input().split(" "))) map(int,input().split(" ")) t koji_um = set([]) set([]) koji_um s,t,x = (map(int,input().split(" "))) map(int,input().split(" ")) s N,Q = map(int,input().split(" ")) map(int,input().split(" ")) N s -=(x + 0.5) x + 0.5 s GO = 2 2 GO time,qtype,place = query query time qtype,place = query query qtype GOAL = 0 0 GOAL Q = map(int,input().split(" ")) map(int,input().split(" ")) Q place = query query place querys = [] [] querys x = (map(int,input().split(" "))) map(int,input().split(" ")) x START = 1 1 START t -= (x + 0.5) x + 0.5 t koji_place = [] [] koji_place input=sys.stdin.readline sys.stdin.readline input
import heapq
import sys
input=sys.stdin.readline

N,Q = map(int,input().split(" "))
querys = []
START = 1
GOAL = 0
GO = 2

for _ in range(N):
    s,t,x = (map(int,input().split(" ")))
    s -=(x + 0.5)
    t -= (x + 0.5)
    querys.append( (s,START,x) )
    querys.append( (t,GOAL,x) )

for _ in range(Q):

    querys.append( (int(input()),GO,-1)  )
koji_place = []
koji_um = set([])
heapq.heapify(koji_place)
querys.sort()
for query in querys:
    time,qtype,place = query
    if qtype == START:
        heapq.heappush(koji_place,place)
        koji_um.add(place)
    elif qtype == GOAL:
        koji_um.remove(place)
    else:
        while koji_place and koji_place[0] not in koji_um: #更新と最近の場所のチェックを同時に行う
            heapq.heappop(koji_place) #koji place のpopは最大で place分，つまり合計で10 ** 5回行われるため ここのwhile
            # はOに影響を与えない
        if not koji_place:
            print(-1)
        else:
            print(koji_place[0])



