import sys
input = sys.stdin.readline
INF = 1<<31
from heapq import heapify,heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
event = []
for _ in range(N):
    s,t,x = map(int,input().split())
    event.append((s - x,-1,x))
    event.append((t - x,0,x))
for i in range(Q):
    d = int(input())
    event.append((d,1,i))

q = []
ans = [-1] * Q
event.sort()
push = defaultdict(int)
pop = defaultdict(int)
for i in range(2*N + Q):
    t,typ,x = event[i]
    if typ == -1:
        heappush(q,x)
        push[x] += 1
    elif typ == 0:
        pop[x] += 1
    else:
        p = -1
        if q:
            p = q[0]
        while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
        ans[x] = p
print('\n'.join(map(str,ans))) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline INF = 1<<31 INF 1<<31 1 31 from heapq import heapify,heappop,heappush 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 _ in range(N):
    s,t,x = map(int,input().split())
    event.append((s - x,-1,x))
    event.append((t - x,0,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 event.append((s - x,-1,x)) event.append event append (s - x,-1,x) s - x s x -1 x event.append((t - x,0,x)) event.append event append (t - x,0,x) t - x t x 0 x for i in range(Q):
    d = int(input())
    event.append((d,1,i)) i range(Q) range Q d = int(input()) d int(input()) int input() input event.append((d,1,i)) event.append event append (d,1,i) d 1 i q = [] q [] ans = [-1] * Q ans [-1] * Q [-1] -1 Q event.sort() event.sort event sort push = defaultdict(int) push defaultdict(int) defaultdict int pop = defaultdict(int) pop defaultdict(int) defaultdict int for i in range(2*N + Q):
    t,typ,x = event[i]
    if typ == -1:
        heappush(q,x)
        push[x] += 1
    elif typ == 0:
        pop[x] += 1
    else:
        p = -1
        if q:
            p = q[0]
        while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
        ans[x] = p i range(2*N + Q) range 2*N + Q 2*N 2 N Q t,typ,x = event[i] t event[i] event i typ x if typ == -1:
        heappush(q,x)
        push[x] += 1
    elif typ == 0:
        pop[x] += 1
    else:
        p = -1
        if q:
            p = q[0]
        while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
        ans[x] = p typ == -1 typ -1 heappush(q,x) heappush q x push[x] += 1 push[x] push x 1 elif typ == 0:
        pop[x] += 1
     typ == 0 typ 0 pop[x] += 1 pop[x] pop x 1 p = -1 p -1 if q:
            p = q[0]
         q p = q[0] p q[0] q 0 while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
         p != -1 and push[p] - pop[p] == 0 p != -1 p -1 push[p] - pop[p] == 0 push[p] - pop[p] push[p] push p pop[p] pop p 0 heappop(q) heappop q if q:
                p = q[0]
            else:
                p = -1
                break
         q p = q[0] p q[0] q 0 p = -1 p -1 break ans[x] = p ans[x] ans x p print('\n'.join(map(str,ans))) print '\n'.join(map(str,ans)) '\n'.join '\n' join map(str,ans) map str ans input = sys.stdin.readline sys.stdin.readline input event = [] [] event INF = 1<<31 1<<31 INF push = defaultdict(int) defaultdict(int) push t,x = map(int,input().split()) map(int,input().split()) t t,typ,x = event[i] event[i] t p = -1 -1 p typ,x = event[i] event[i] typ p = q[0] q[0] p p = q[0] q[0] p ans = [-1] * Q [-1] * Q ans s,t,x = map(int,input().split()) map(int,input().split()) s x = map(int,input().split()) map(int,input().split()) x d = int(input()) int(input()) d N,Q = map(int,input().split()) map(int,input().split()) N Q = map(int,input().split()) map(int,input().split()) Q x = event[i] event[i] x q = [] [] q p = -1 -1 p pop = defaultdict(int) defaultdict(int) pop
import sys
input = sys.stdin.readline
INF = 1<<31
from heapq import heapify,heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
event = []
for _ in range(N):
    s,t,x = map(int,input().split())
    event.append((s - x,-1,x))
    event.append((t - x,0,x))
for i in range(Q):
    d = int(input())
    event.append((d,1,i))

q = []
ans = [-1] * Q
event.sort()
push = defaultdict(int)
pop = defaultdict(int)
for i in range(2*N + Q):
    t,typ,x = event[i]
    if typ == -1:
        heappush(q,x)
        push[x] += 1
    elif typ == 0:
        pop[x] += 1
    else:
        p = -1
        if q:
            p = q[0]
        while p != -1 and push[p] - pop[p] == 0:
            heappop(q)
            if q:
                p = q[0]
            else:
                p = -1
                break
        ans[x] = p
print('\n'.join(map(str,ans)))