import bisect
n,q = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l = sorted(l,key = lambda x: x[2])
d = [int(input()) for i in range(q)]

ans = [-1]*q
skip = [-1]*q
for s,t,x in l:
    le = bisect.bisect_left(d,s-x)
    ri = bisect.bisect_left(d,t-x)
    while le < ri:
        if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le]

for i in ans:
    print(i) import bisect bisect 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 l = [list(map(int,input().split())) for i in range(n)] l [list(map(int,input().split())) for i in range(n)] l = sorted(l,key = lambda x: x[2]) l sorted(l,key = lambda x: x[2]) sorted l key = lambda x: x[2] key lambda x: x[2] x[2] x 2 x 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)] ans = [-1]*q ans [-1]*q [-1] -1 q skip = [-1]*q skip [-1]*q [-1] -1 q for s,t,x in l:
    le = bisect.bisect_left(d,s-x)
    ri = bisect.bisect_left(d,t-x)
    while le < ri:
        if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le] s t x l le = bisect.bisect_left(d,s-x) le bisect.bisect_left(d,s-x) bisect.bisect_left bisect bisect_left d s-x s x ri = bisect.bisect_left(d,t-x) ri bisect.bisect_left(d,t-x) bisect.bisect_left bisect bisect_left d t-x t x while le < ri:
        if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le] le < ri le ri if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le] skip[le] == -1 skip[le] skip le -1 ans[le] = x ans[le] ans le x skip[le] = ri skip[le] skip le ri le += 1 le 1 le = skip[le] le skip[le] skip le for i in ans:
    print(i) i ans print(i) print i n,q = map(int,input().split()) map(int,input().split()) n le = bisect.bisect_left(d,s-x) bisect.bisect_left(d,s-x) le ri = bisect.bisect_left(d,t-x) bisect.bisect_left(d,t-x) ri q = map(int,input().split()) map(int,input().split()) q d = [int(input()) for i in range(q)] [int(input()) for i in range(q)] d l = [list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] l l = sorted(l,key = lambda x: x[2]) sorted(l,key = lambda x: x[2]) l le = skip[le] skip[le] le skip = [-1]*q [-1]*q skip le += 1 1 le ans = [-1]*q [-1]*q ans
import bisect
n,q = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l = sorted(l,key = lambda x: x[2])
d = [int(input()) for i in range(q)]

ans = [-1]*q
skip = [-1]*q
for s,t,x in l:
    le = bisect.bisect_left(d,s-x)
    ri = bisect.bisect_left(d,t-x)
    while le < ri:
        if skip[le] == -1:
            ans[le] = x
            skip[le] = ri
            le += 1
        else:
            le = skip[le]

for i in ans:
    print(i)
