import sys
import bisect

input = sys.stdin.readline

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

STX_array = [list(map(int, input().split())) for _ in range(N)]

STX_array = sorted(STX_array, key=lambda x: x[2])

Q_array = [int(input()) for _ in range(Q)]

index_array = [i for i in range(Q)]

ans_array = [-1] * Q
for STX in STX_array:
    s, t, x = STX
    index_left = bisect.bisect_left(Q_array, s - 0.5 - x)
    index_right = bisect.bisect_left(Q_array, t - 0.5 - x)
    if index_left != index_right:
        now_index = index_left
        while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index




for ans in ans_array:
    print(ans) 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_array = [list(map(int, input().split())) for _ in range(N)] STX_array [list(map(int, input().split())) for _ in range(N)] STX_array = sorted(STX_array, key=lambda x: x[2]) STX_array sorted(STX_array, key=lambda x: x[2]) sorted STX_array 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 Q_array = [int(input()) for _ in range(Q)] Q_array [int(input()) for _ in range(Q)] i for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) i index_array = [i for i in range(Q)] index_array [i for i in range(Q)] ans_array = [-1] * Q ans_array [-1] * Q [-1] -1 Q for STX in STX_array:
    s, t, x = STX
    index_left = bisect.bisect_left(Q_array, s - 0.5 - x)
    index_right = bisect.bisect_left(Q_array, t - 0.5 - x)
    if index_left != index_right:
        now_index = index_left
        while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index STX STX_array s, t, x = STX s STX t x index_left = bisect.bisect_left(Q_array, s - 0.5 - x) index_left bisect.bisect_left(Q_array, s - 0.5 - x) bisect.bisect_left bisect bisect_left Q_array s - 0.5 - x s - 0.5 s 0.5 x index_right = bisect.bisect_left(Q_array, t - 0.5 - x) index_right bisect.bisect_left(Q_array, t - 0.5 - x) bisect.bisect_left bisect bisect_left Q_array t - 0.5 - x t - 0.5 t 0.5 x if index_left != index_right:
        now_index = index_left
        while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index index_left != index_right index_left index_right now_index = index_left now_index index_left while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index now_index < index_right now_index index_right if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index index_array[now_index] == now_index index_array[now_index] index_array now_index now_index ans_array[now_index] = x ans_array[now_index] ans_array now_index x index_array[now_index] = index_right index_array[now_index] index_array now_index index_right now_index += 1 now_index 1 old_index = now_index old_index now_index now_index = index_array[now_index] now_index index_array[now_index] index_array now_index index_array[old_index] = now_index index_array[old_index] index_array old_index now_index for ans in ans_array:
    print(ans) ans ans_array print(ans) print ans ans_array = [-1] * Q [-1] * Q ans_array old_index = now_index now_index old_index now_index = index_array[now_index] index_array[now_index] now_index input = sys.stdin.readline sys.stdin.readline input index_array = [i for i in range(Q)] [i for i in range(Q)] index_array STX_array = sorted(STX_array, key=lambda x: x[2]) sorted(STX_array, key=lambda x: x[2]) STX_array now_index = index_left index_left now_index Q = map(int, input().split()) map(int, input().split()) Q N, Q = map(int, input().split()) map(int, input().split()) N x = STX STX x index_left = bisect.bisect_left(Q_array, s - 0.5 - x) bisect.bisect_left(Q_array, s - 0.5 - x) index_left t, x = STX STX t index_right = bisect.bisect_left(Q_array, t - 0.5 - x) bisect.bisect_left(Q_array, t - 0.5 - x) index_right now_index += 1 1 now_index Q_array = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] Q_array STX_array = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] STX_array s, t, x = STX STX s
import sys
import bisect

input = sys.stdin.readline

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

STX_array = [list(map(int, input().split())) for _ in range(N)]

STX_array = sorted(STX_array, key=lambda x: x[2])

Q_array = [int(input()) for _ in range(Q)]

index_array = [i for i in range(Q)]

ans_array = [-1] * Q
for STX in STX_array:
    s, t, x = STX
    index_left = bisect.bisect_left(Q_array, s - 0.5 - x)
    index_right = bisect.bisect_left(Q_array, t - 0.5 - x)
    if index_left != index_right:
        now_index = index_left
        while now_index < index_right:
            if index_array[now_index] == now_index:
                ans_array[now_index] = x
                index_array[now_index] = index_right
                now_index += 1
            else:
                old_index = now_index
                now_index = index_array[now_index]
                index_array[old_index] = now_index




for ans in ans_array:
    print(ans)