import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
import bisect

N,Q = map(int,input().split())
# STX = [list(map(int,input().split())) for _ in range (N)]
STX = []
vals = set()
for _ in range(N):
    s,t,x = map(int,input().split())
    STX.append((max(0,s-x), max(0,t-x), x))
    vals.add(max(0,s-x))
    vals.add(max(0,t-x))
D = [int(input()) for _ in range(Q)]
for d in D:
    vals.add(d)
vals = list(vals)
vals.sort()
L = len(vals)
mapping = [-1]*(L+1)
imos = [[] for _ in range(L+1)]
STX.sort(key=lambda x:x[2])
priority = 0 
for s,t,x in STX:
    s1 = bisect.bisect_left(vals, s)
    t1 = bisect.bisect_left(vals, t)
    imos[s1].append([1, priority, x])
    imos[t1].append([0, priority, x])
    priority += 1

import heapq
cur = -1
cur_priority = 10**9
que = [(cur_priority, cur)]
valid_priority = [True]*(N+1)
for i in range(L+1):
    for f,p,x in  imos[i]:
        if f:
            heapq.heappush(que, (p, x))
        else:
            valid_priority[p] = False
    
    while que[0][1]!=-1 and valid_priority[que[0][0]]==False:
        heapq.heappop(que)
    mapping[i] = que[0][1]

for d in D:
    d1 = bisect.bisect_left(vals, d)
    print(mapping[d1])
 import sys sys sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import bisect bisect N,Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q STX = [] STX [] vals = set() vals set() set for _ in range(N):
    s,t,x = map(int,input().split())
    STX.append((max(0,s-x), max(0,t-x), x))
    vals.add(max(0,s-x))
    vals.add(max(0,t-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 STX.append((max(0,s-x), max(0,t-x), x)) STX.append STX append (max(0,s-x), max(0,t-x), x) max(0,s-x) max 0 s-x s x max(0,t-x) max 0 t-x t x x vals.add(max(0,s-x)) vals.add vals add max(0,s-x) max 0 s-x s x vals.add(max(0,t-x)) vals.add vals add max(0,t-x) max 0 t-x t x int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] for d in D:
    vals.add(d) d D vals.add(d) vals.add vals add d vals = list(vals) vals list(vals) list vals vals.sort() vals.sort vals sort L = len(vals) L len(vals) len vals mapping = [-1]*(L+1) mapping [-1]*(L+1) [-1] -1 L+1 L 1 [] for _ in range(L+1) for _ in range(L+1) _ range(L+1) range L+1 L 1 for _ in range(L+1) [] imos = [[] for _ in range(L+1)] imos [[] for _ in range(L+1)] STX.sort(key=lambda x:x[2]) STX.sort STX sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x priority = 0 priority 0 for s,t,x in STX:
    s1 = bisect.bisect_left(vals, s)
    t1 = bisect.bisect_left(vals, t)
    imos[s1].append([1, priority, x])
    imos[t1].append([0, priority, x])
    priority += 1 s t x STX s1 = bisect.bisect_left(vals, s) s1 bisect.bisect_left(vals, s) bisect.bisect_left bisect bisect_left vals s t1 = bisect.bisect_left(vals, t) t1 bisect.bisect_left(vals, t) bisect.bisect_left bisect bisect_left vals t imos[s1].append([1, priority, x]) [s1].append [s1] imos s1 append [1, priority, x] 1 priority x imos[t1].append([0, priority, x]) [t1].append [t1] imos t1 append [0, priority, x] 0 priority x priority += 1 priority 1 import heapq heapq cur = -1 cur -1 cur_priority = 10**9 cur_priority 10**9 10 9 que = [(cur_priority, cur)] que [(cur_priority, cur)] (cur_priority, cur) cur_priority cur valid_priority = [True]*(N+1) valid_priority [True]*(N+1) [True] True N+1 N 1 for i in range(L+1):
    for f,p,x in  imos[i]:
        if f:
            heapq.heappush(que, (p, x))
        else:
            valid_priority[p] = False
    
    while que[0][1]!=-1 and valid_priority[que[0][0]]==False:
        heapq.heappop(que)
    mapping[i] = que[0][1] i range(L+1) range L+1 L 1 for f,p,x in  imos[i]:
        if f:
            heapq.heappush(que, (p, x))
        else:
            valid_priority[p] = False
    
     f p x imos[i] imos i if f:
            heapq.heappush(que, (p, x))
        else:
            valid_priority[p] = False
    
     f heapq.heappush(que, (p, x)) heapq.heappush heapq heappush que (p, x) p x valid_priority[p] = False valid_priority[p] valid_priority p False while que[0][1]!=-1 and valid_priority[que[0][0]]==False:
        heapq.heappop(que)
     que[0][1]!=-1 and valid_priority[que[0][0]]==False que[0][1]!=-1 que[0][1] [0] que 0 1 -1 valid_priority[que[0][0]]==False valid_priority[que[0][0]] valid_priority que[0][0] [0] que 0 0 False heapq.heappop(que) heapq.heappop heapq heappop que mapping[i] = que[0][1] mapping[i] mapping i que[0][1] [0] que 0 1 for d in D:
    d1 = bisect.bisect_left(vals, d)
    print(mapping[d1]) d D d1 = bisect.bisect_left(vals, d) d1 bisect.bisect_left(vals, d) bisect.bisect_left bisect bisect_left vals d print(mapping[d1]) print mapping[d1] mapping d1 input = sys.stdin.readline sys.stdin.readline input Q = map(int,input().split()) map(int,input().split()) Q s,t,x = map(int,input().split()) map(int,input().split()) s vals = list(vals) list(vals) vals valid_priority = [True]*(N+1) [True]*(N+1) valid_priority t1 = bisect.bisect_left(vals, t) bisect.bisect_left(vals, t) t1 que = [(cur_priority, cur)] [(cur_priority, cur)] que D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D L = len(vals) len(vals) L priority = 0 0 priority N,Q = map(int,input().split()) map(int,input().split()) N s1 = bisect.bisect_left(vals, s) bisect.bisect_left(vals, s) s1 cur_priority = 10**9 10**9 cur_priority imos = [[] for _ in range(L+1)] [[] for _ in range(L+1)] imos vals = set() set() vals STX = [] [] STX x = map(int,input().split()) map(int,input().split()) x mapping = [-1]*(L+1) [-1]*(L+1) mapping t,x = map(int,input().split()) map(int,input().split()) t cur = -1 -1 cur d1 = bisect.bisect_left(vals, d) bisect.bisect_left(vals, d) d1 priority += 1 1 priority
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
import bisect

N,Q = map(int,input().split())
# STX = [list(map(int,input().split())) for _ in range (N)]
STX = []
vals = set()
for _ in range(N):
    s,t,x = map(int,input().split())
    STX.append((max(0,s-x), max(0,t-x), x))
    vals.add(max(0,s-x))
    vals.add(max(0,t-x))
D = [int(input()) for _ in range(Q)]
for d in D:
    vals.add(d)
vals = list(vals)
vals.sort()
L = len(vals)
mapping = [-1]*(L+1)
imos = [[] for _ in range(L+1)]
STX.sort(key=lambda x:x[2])
priority = 0 
for s,t,x in STX:
    s1 = bisect.bisect_left(vals, s)
    t1 = bisect.bisect_left(vals, t)
    imos[s1].append([1, priority, x])
    imos[t1].append([0, priority, x])
    priority += 1

import heapq
cur = -1
cur_priority = 10**9
que = [(cur_priority, cur)]
valid_priority = [True]*(N+1)
for i in range(L+1):
    for f,p,x in  imos[i]:
        if f:
            heapq.heappush(que, (p, x))
        else:
            valid_priority[p] = False
    
    while que[0][1]!=-1 and valid_priority[que[0][0]]==False:
        heapq.heappop(que)
    mapping[i] = que[0][1]

for d in D:
    d1 = bisect.bisect_left(vals, d)
    print(mapping[d1])

