#ref : https://atcoder.jp/contests/abc128/submissions/5694292
#工事を座標順に処理，工事にぶつかる人をにぶたん
#すでに更新済みだったら更新しない．-> jumpで管理
from bisect import bisect_left
N, Q = map(int, input().split())
consts = []
for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t))
consts.sort()
D=[int(input()) for _ in range(Q)]
ans=[-1]*Q
jump=[-1]*Q
for x,s,t in consts:
    left=bisect_left(D,s-x)
    right=bisect_left(D,t-x)
    while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left]
print(*ans, sep='\n') from bisect import bisect_left N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q consts = [] consts [] for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t)) _ 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 consts.append((x,s,t)) consts.append consts append (x,s,t) x s t consts.sort() consts.sort consts sort 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)] ans=[-1]*Q ans [-1]*Q [-1] -1 Q jump=[-1]*Q jump [-1]*Q [-1] -1 Q for x,s,t in consts:
    left=bisect_left(D,s-x)
    right=bisect_left(D,t-x)
    while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left] x s t consts left=bisect_left(D,s-x) left bisect_left(D,s-x) bisect_left D s-x s x right=bisect_left(D,t-x) right bisect_left(D,t-x) bisect_left D t-x t x while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left] left<right left right if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left] jump[left]==-1 jump[left] jump left -1 ans[left]=x ans[left] ans left x jump[left]=right jump[left] jump left right left += 1 left 1 left=jump[left] left jump[left] jump left print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' jump=[-1]*Q [-1]*Q jump consts = [] [] consts t,x = map(int, input().split()) map(int, input().split()) t x = map(int, input().split()) map(int, input().split()) x left=bisect_left(D,s-x) bisect_left(D,s-x) left D=[int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D left=jump[left] jump[left] left left += 1 1 left s,t,x = map(int, input().split()) map(int, input().split()) s N, Q = map(int, input().split()) map(int, input().split()) N Q = map(int, input().split()) map(int, input().split()) Q ans=[-1]*Q [-1]*Q ans right=bisect_left(D,t-x) bisect_left(D,t-x) right
#ref : https://atcoder.jp/contests/abc128/submissions/5694292
#工事を座標順に処理，工事にぶつかる人をにぶたん
#すでに更新済みだったら更新しない．-> jumpで管理
from bisect import bisect_left
N, Q = map(int, input().split())
consts = []
for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t))
consts.sort()
D=[int(input()) for _ in range(Q)]
ans=[-1]*Q
jump=[-1]*Q
for x,s,t in consts:
    left=bisect_left(D,s-x)
    right=bisect_left(D,t-x)
    while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left]
print(*ans, sep='\n')