import sys
import bisect

input = sys.stdin.readline

N, Q = map(int, input().split())

STX = [list(map(int, input().split())) for _ in range(N)]
# xの昇順に工事の区間をsort
STX = sorted(STX, key=lambda x: x[2])

D = [int(input()) for _ in range(Q)]
ans = [-1] * Q
index = [-1] * Q
for s, t, x in STX:
    left = bisect.bisect_left(D, s - x - 0.5)
    right = bisect.bisect_left(D, t - x - 0.5)
    now = left
    while now < right:
        if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
            

for a in ans:
    print(a) import sys sys import bisect bisect input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split STX = [list(map(int, input().split())) for _ in range(N)] STX [list(map(int, input().split())) for _ in range(N)] STX = sorted(STX, key=lambda x: x[2]) STX sorted(STX, key=lambda x: x[2]) sorted STX 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 index = [-1] * Q index [-1] * Q [-1] -1 Q for s, t, x in STX:
    left = bisect.bisect_left(D, s - x - 0.5)
    right = bisect.bisect_left(D, t - x - 0.5)
    now = left
    while now < right:
        if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
             s t x STX left = bisect.bisect_left(D, s - x - 0.5) left bisect.bisect_left(D, s - x - 0.5) bisect.bisect_left bisect bisect_left D s - x - 0.5 s - x s x 0.5 right = bisect.bisect_left(D, t - x - 0.5) right bisect.bisect_left(D, t - x - 0.5) bisect.bisect_left bisect bisect_left D t - x - 0.5 t - x t x 0.5 now = left now left while now < right:
        if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
             now < right now right if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
             index[now] == -1 index[now] index now -1 ans[now] = x ans[now] ans now x index[now] = right index[now] index now right now += 1 now 1 now = index[now] now index[now] index now for a in ans:
    print(a) a ans print(a) print a STX = sorted(STX, key=lambda x: x[2]) sorted(STX, key=lambda x: x[2]) STX now += 1 1 now now = left left now STX = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] STX Q = map(int, input().split()) map(int, input().split()) Q D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D ans = [-1] * Q [-1] * Q ans index = [-1] * Q [-1] * Q index input = sys.stdin.readline sys.stdin.readline input left = bisect.bisect_left(D, s - x - 0.5) bisect.bisect_left(D, s - x - 0.5) left N, Q = map(int, input().split()) map(int, input().split()) N now = index[now] index[now] now right = bisect.bisect_left(D, t - x - 0.5) bisect.bisect_left(D, t - x - 0.5) right
import sys
import bisect

input = sys.stdin.readline

N, Q = map(int, input().split())

STX = [list(map(int, input().split())) for _ in range(N)]
# xの昇順に工事の区間をsort
STX = sorted(STX, key=lambda x: x[2])

D = [int(input()) for _ in range(Q)]
ans = [-1] * Q
index = [-1] * Q
for s, t, x in STX:
    left = bisect.bisect_left(D, s - x - 0.5)
    right = bisect.bisect_left(D, t - x - 0.5)
    now = left
    while now < right:
        if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
            

for a in ans:
    print(a)