import sys
import bisect
from heapq import heappop, heappush, heapify
input = sys.stdin.readline
from itertools import chain
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)]

inf = 10**15
TEMP = [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]]
PFX = sorted(list(chain(*TEMP)))

addq = [inf]
delq = [inf+1]
D.append(inf)
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)
        d = next(iterD)
        if d == inf:
            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 from itertools import chain 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)] inf = 10**15 inf 10**15 10 15 [(s-x,True,x),(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 [(s-x,True,x),(t-x,False,x)] (s-x,True,x) s-x s x True x (t-x,False,x) t-x t x False x TEMP = [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]] TEMP [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]] [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] [[(-inf,True,inf),(inf,False,inf)]] [(-inf,True,inf),(inf,False,inf)] (-inf,True,inf) -inf inf True inf (inf,False,inf) inf False inf PFX = sorted(list(chain(*TEMP))) PFX sorted(list(chain(*TEMP))) sorted list(chain(*TEMP)) list chain(*TEMP) chain *TEMP TEMP addq = [inf] addq [inf] inf delq = [inf+1] delq [inf+1] inf+1 inf 1 D.append(inf) D.append D append inf 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)
        d = next(iterD)
        if d == inf:
            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)
        d = next(iterD)
        if d == inf:
            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 d = next(iterD) d next(iterD) next iterD if d == inf:
            exit()
     d == inf d inf exit() exit 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 iterD = iter(D) iter(D) iterD d = next(iterD) next(iterD) d addq = [inf] [inf] addq delq = [inf+1] [inf+1] delq Q= map(int,input().split()) map(int,input().split()) Q TEMP = [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]] [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]] TEMP D = [int(input()) for i in range(Q)] [int(input()) for i in range(Q)] D ans = addq[0] if not addq[0] == inf else -1 addq[0] if not addq[0] == inf else -1 ans input = sys.stdin.readline sys.stdin.readline input inf = 10**15 10**15 inf PFX = sorted(list(chain(*TEMP))) sorted(list(chain(*TEMP))) PFX d = next(iterD) next(iterD) d STX = [list(map(int,input().split())) for i in range(N)] [list(map(int,input().split())) for i in range(N)] STX
import sys
import bisect
from heapq import heappop, heappush, heapify
input = sys.stdin.readline
from itertools import chain
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)]

inf = 10**15
TEMP = [[(s-x,True,x),(t-x,False,x)] for s,t,x in STX] + [[(-inf,True,inf),(inf,False,inf)]]
PFX = sorted(list(chain(*TEMP)))

addq = [inf]
delq = [inf+1]
D.append(inf)
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)
        d = next(iterD)
        if d == inf:
            exit()
    if f:
        heappush(addq, x)
    else:
        heappush(delq, x)
    while addq[0] == delq[0]:
        heappop(addq)
        heappop(delq)




