import sys
input = sys.stdin.readline
from bisect import bisect_left
N, Q = map(int, input().split())
W = [tuple(map(int, input().split())) for _ in range(N)]
W.sort(key=lambda x:x[2])
D = [int(input()) for _ in range(Q)]
ans = [-1]*Q
skip = [-1]*Q
for s, t, x in W:
    l = bisect_left(D, s-x)
    r = bisect_left(D, t-x)
    while l < r:
        if skip[l] == -1:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l]
print(*ans, sep='\n') import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tuple(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split W = [tuple(map(int, input().split())) for _ in range(N)] W [tuple(map(int, input().split())) for _ in range(N)] W.sort(key=lambda x:x[2]) W.sort W sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x 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 skip = [-1]*Q skip [-1]*Q [-1] -1 Q for s, t, x in W:
    l = bisect_left(D, s-x)
    r = bisect_left(D, t-x)
    while l < r:
        if skip[l] == -1:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l] s t x W l = bisect_left(D, s-x) l bisect_left(D, s-x) bisect_left D s-x s x r = bisect_left(D, t-x) r bisect_left(D, t-x) bisect_left D t-x t x while l < r:
        if skip[l] == -1:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l] l < r l r if skip[l] == -1:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l] skip[l] == -1 skip[l] skip l -1 ans[l] = x ans[l] ans l x skip[l] = r skip[l] skip l r l += 1 l 1 l = skip[l] l skip[l] skip l print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' N, Q = map(int, input().split()) map(int, input().split()) N Q = map(int, input().split()) map(int, input().split()) Q W = [tuple(map(int, input().split())) for _ in range(N)] [tuple(map(int, input().split())) for _ in range(N)] W skip = [-1]*Q [-1]*Q skip l += 1 1 l ans = [-1]*Q [-1]*Q ans input = sys.stdin.readline sys.stdin.readline input l = bisect_left(D, s-x) bisect_left(D, s-x) l r = bisect_left(D, t-x) bisect_left(D, t-x) r l = skip[l] skip[l] l D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D
import sys
input = sys.stdin.readline
from bisect import bisect_left
N, Q = map(int, input().split())
W = [tuple(map(int, input().split())) for _ in range(N)]
W.sort(key=lambda x:x[2])
D = [int(input()) for _ in range(Q)]
ans = [-1]*Q
skip = [-1]*Q
for s, t, x in W:
    l = bisect_left(D, s-x)
    r = bisect_left(D, t-x)
    while l < r:
        if skip[l] == -1:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l]
print(*ans, sep='\n')