from bisect import bisect_left, bisect_right

N,Q = map(int, input().split())
STX = [[int(i) for i in input().split()] for _ in range(N)]
D = [int(input()) for _ in range(Q)]

STX.sort(key=lambda x:x[2])

ans = [-1] * Q
skip = [-1] * Q

for S, T, X in STX:
    # [S - X, T - X)
    left = bisect_left(D, S - X)
    right = bisect_right(D, T - X - 1)

    while left < right:
        if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left]

print(*ans, sep="\n") from bisect import bisect_left, bisect_right N,Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q [int(i) for i in input().split()] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [int(i) for i in input().split()] STX = [[int(i) for i in input().split()] for _ in range(N)] STX [[int(i) for i in input().split()] for _ in range(N)] 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)] 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 ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q for S, T, X in STX:
    # [S - X, T - X)
    left = bisect_left(D, S - X)
    right = bisect_right(D, T - X - 1)

    while left < right:
        if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left] S T X STX left = bisect_left(D, S - X) left bisect_left(D, S - X) bisect_left D S - X S X right = bisect_right(D, T - X - 1) right bisect_right(D, T - X - 1) bisect_right D T - X - 1 T - X T X 1 while left < right:
        if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left] left < right left right if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left] skip[left] < 0 skip[left] skip left 0 skip[left] = right skip[left] skip left right ans[left] = X ans[left] ans left X left += 1 left 1 left = skip[left] left skip[left] skip left print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" left += 1 1 left N,Q = map(int, input().split()) map(int, input().split()) N STX = [[int(i) for i in input().split()] for _ in range(N)] [[int(i) for i in input().split()] for _ in range(N)] STX left = bisect_left(D, S - X) bisect_left(D, S - X) left Q = map(int, input().split()) map(int, input().split()) Q skip = [-1] * Q [-1] * Q skip ans = [-1] * Q [-1] * Q ans left = skip[left] skip[left] left D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D right = bisect_right(D, T - X - 1) bisect_right(D, T - X - 1) right
from bisect import bisect_left, bisect_right

N,Q = map(int, input().split())
STX = [[int(i) for i in input().split()] for _ in range(N)]
D = [int(input()) for _ in range(Q)]

STX.sort(key=lambda x:x[2])

ans = [-1] * Q
skip = [-1] * Q

for S, T, X in STX:
    # [S - X, T - X)
    left = bisect_left(D, S - X)
    right = bisect_right(D, T - X - 1)

    while left < right:
        if skip[left] < 0:
            skip[left] = right
            ans[left] = X
            left += 1
        else:
            left = skip[left]

print(*ans, sep="\n")