from heapq import 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,2,x))

for i in range(Q):
    d = int(input())
    event.append((d,3,i))
event.sort()

memo = defaultdict(int)
nowStop = []
ans = [-1]*Q
for t,e,x in event:
    if e == 1:
        heappush(nowStop,x)
        memo[x] += 1
    if e == 2:
        memo[x] -= 1
    if e == 3:
        while nowStop:
            s = nowStop[0]
            if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break
for a in ans:
    print(a) from heapq import 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,2,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,2,x)) event.append event append (t-x,2,x) t-x t x 2 x for i in range(Q):
    d = int(input())
    event.append((d,3,i)) i range(Q) range Q d = int(input()) d int(input()) int input() input event.append((d,3,i)) event.append event append (d,3,i) d 3 i event.sort() event.sort event sort memo = defaultdict(int) memo defaultdict(int) defaultdict int nowStop = [] nowStop [] ans = [-1]*Q ans [-1]*Q [-1] -1 Q for t,e,x in event:
    if e == 1:
        heappush(nowStop,x)
        memo[x] += 1
    if e == 2:
        memo[x] -= 1
    if e == 3:
        while nowStop:
            s = nowStop[0]
            if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break t e x event if e == 1:
        heappush(nowStop,x)
        memo[x] += 1
     e == 1 e 1 heappush(nowStop,x) heappush nowStop x memo[x] += 1 memo[x] memo x 1 if e == 2:
        memo[x] -= 1
     e == 2 e 2 memo[x] -= 1 memo[x] memo x 1 if e == 3:
        while nowStop:
            s = nowStop[0]
            if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break e == 3 e 3 while nowStop:
            s = nowStop[0]
            if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break nowStop s = nowStop[0] s nowStop[0] nowStop 0 if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break memo[s] == 0 memo[s] memo s 0 heappop(nowStop) heappop nowStop ans[x] = s ans[x] ans x s break for a in ans:
    print(a) a ans print(a) print a Q = map(int,input().split()) map(int,input().split()) Q memo = defaultdict(int) defaultdict(int) memo t,x = map(int,input().split()) map(int,input().split()) t ans = [-1]*Q [-1]*Q ans nowStop = [] [] nowStop event = [] [] event s,t,x = map(int,input().split()) map(int,input().split()) s N,Q = map(int,input().split()) map(int,input().split()) N x = map(int,input().split()) map(int,input().split()) x s = nowStop[0] nowStop[0] s d = int(input()) int(input()) d
from heapq import 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,2,x))

for i in range(Q):
    d = int(input())
    event.append((d,3,i))
event.sort()

memo = defaultdict(int)
nowStop = []
ans = [-1]*Q
for t,e,x in event:
    if e == 1:
        heappush(nowStop,x)
        memo[x] += 1
    if e == 2:
        memo[x] -= 1
    if e == 3:
        while nowStop:
            s = nowStop[0]
            if memo[s] == 0:
                heappop(nowStop)
            else:
                ans[x] = s
                break
for a in ans:
    print(a)