import sys
import bisect
from heapq import heappop, heappush, heapify
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
N,Q= map(int,input().split())
STX = [list(map(int,input().split())) for i in range(N)]
D = [int(input()) for i in range(Q)]

'''
import random
N = 2*10**5
Q = 2*10**5
STX = []
for i in range(N):
    S,T = sorted([random.randint(0,10**9-1) for i in range(2)])
    if S == T:
        T += 1
    X = random.randint(1,10**9)
    STX.append([S,T,X])
D = sorted([random.randint(0,10*9) for i in range(Q)])
'''

inf = 10**15
PFXS = [(s-x,True,x) for s,t,x in STX]
PFXT = [(t-x,False,x) for s,t,x in STX]
PFX = PFXS + PFXT
PFX.append((-inf,True,inf))
PFX.append((inf,False,inf))
PFX.sort()

addq = [inf]
delq = [inf+1]
iterD = iter(D)

d = next(iterD)
for p,f,x in PFX:
    while d < p:
        ans = addq[0] if not addq[0] == inf else -1
        print(ans)
        try:
            d = next(iterD)
        except:
            exit()
    if f:
        heappush(addq, x)
    else:
        heappush(delq, x)
    while addq[0] == delq[0]:
        heappop(addq)
        heappop(delq)



 import sys sys import bisect bisect from heapq import heappop, heappush, heapify input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 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 i in range(N) for i in range(N) i range(N) range N for i 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 i in range(N)] STX [list(map(int,input().split())) for i in range(N)] 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 D = [int(input()) for i in range(Q)] D [int(input()) for i in range(Q)] '''
import random
N = 2*10**5
Q = 2*10**5
STX = []
for i in range(N):
    S,T = sorted([random.randint(0,10**9-1) for i in range(2)])
    if S == T:
        T += 1
    X = random.randint(1,10**9)
    STX.append([S,T,X])
D = sorted([random.randint(0,10*9) for i in range(Q)])
''' inf = 10**15 inf 10**15 10 15 (s-x,True,x) for s,t,x in STX for s,t,x in STX s t x STX for s,t,x in STX (s-x,True,x) s-x s x True x PFXS = [(s-x,True,x) for s,t,x in STX] PFXS [(s-x,True,x) for s,t,x in STX] (t-x,False,x) for s,t,x in STX for s,t,x in STX s t x STX for s,t,x in STX (t-x,False,x) t-x t x False x PFXT = [(t-x,False,x) for s,t,x in STX] PFXT [(t-x,False,x) for s,t,x in STX] PFX = PFXS + PFXT PFX PFXS + PFXT PFXS PFXT PFX.append((-inf,True,inf)) PFX.append PFX append (-inf,True,inf) -inf inf True inf PFX.append((inf,False,inf)) PFX.append PFX append (inf,False,inf) inf False inf PFX.sort() PFX.sort PFX sort addq = [inf] addq [inf] inf delq = [inf+1] delq [inf+1] inf+1 inf 1 iterD = iter(D) iterD iter(D) iter D d = next(iterD) d next(iterD) next iterD for p,f,x in PFX:
    while d < p:
        ans = addq[0] if not addq[0] == inf else -1
        print(ans)
        try:
            d = next(iterD)
        except:
            exit()
    if f:
        heappush(addq, x)
    else:
        heappush(delq, x)
    while addq[0] == delq[0]:
        heappop(addq)
        heappop(delq) p f x PFX while d < p:
        ans = addq[0] if not addq[0] == inf else -1
        print(ans)
        try:
            d = next(iterD)
        except:
            exit()
     d < p d p ans = addq[0] if not addq[0] == inf else -1 ans addq[0] if not addq[0] == inf else -1 not addq[0] == inf addq[0] == inf addq[0] addq 0 inf addq[0] addq 0 -1 print(ans) print ans try:
            d = next(iterD)
        except:
            exit()
     except:
            exit()
     exit() exit d = next(iterD) d next(iterD) next iterD if f:
        heappush(addq, x)
    else:
        heappush(delq, x)
     f heappush(addq, x) heappush addq x heappush(delq, x) heappush delq x while addq[0] == delq[0]:
        heappop(addq)
        heappop(delq) addq[0] == delq[0] addq[0] addq 0 delq[0] delq 0 heappop(addq) heappop addq heappop(delq) heappop delq N,Q= map(int,input().split()) map(int,input().split()) N d = next(iterD) next(iterD) d ans = addq[0] if not addq[0] == inf else -1 addq[0] if not addq[0] == inf else -1 ans delq = [inf+1] [inf+1] delq input = sys.stdin.readline sys.stdin.readline input PFX = PFXS + PFXT PFXS + PFXT PFX addq = [inf] [inf] addq D = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] D inf = 10**15 10**15 inf d = next(iterD) next(iterD) d PFXS = [(s-x,True,x) for s,t,x in STX] [(s-x,True,x) for s,t,x in STX] PFXS STX = [list(map(int,input().split())) for i in range(N)] [list(map(int,input().split())) for i in range(N)] STX Q= map(int,input().split()) map(int,input().split()) Q PFXT = [(t-x,False,x) for s,t,x in STX] [(t-x,False,x) for s,t,x in STX] PFXT iterD = iter(D) iter(D) iterD
import sys
import bisect
from heapq import heappop, heappush, heapify
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
N,Q= map(int,input().split())
STX = [list(map(int,input().split())) for i in range(N)]
D = [int(input()) for i in range(Q)]

'''
import random
N = 2*10**5
Q = 2*10**5
STX = []
for i in range(N):
    S,T = sorted([random.randint(0,10**9-1) for i in range(2)])
    if S == T:
        T += 1
    X = random.randint(1,10**9)
    STX.append([S,T,X])
D = sorted([random.randint(0,10*9) for i in range(Q)])
'''

inf = 10**15
PFXS = [(s-x,True,x) for s,t,x in STX]
PFXT = [(t-x,False,x) for s,t,x in STX]
PFX = PFXS + PFXT
PFX.append((-inf,True,inf))
PFX.append((inf,False,inf))
PFX.sort()

addq = [inf]
delq = [inf+1]
iterD = iter(D)

d = next(iterD)
for p,f,x in PFX:
    while d < p:
        ans = addq[0] if not addq[0] == inf else -1
        print(ans)
        try:
            d = next(iterD)
        except:
            exit()
    if f:
        heappush(addq, x)
    else:
        heappush(delq, x)
    while addq[0] == delq[0]:
        heappop(addq)
        heappop(delq)




