from bisect import bisect_left
from operator import itemgetter
import sys

input = sys.stdin.readline

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1] * Q
jump = [-1] * Q
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t) from bisect import bisect_left from operator import itemgetter import sys sys 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 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 " " check_points = [tuple(map(int, input().split(" "))) for _ in range(N)] check_points [tuple(map(int, 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 querys = [int(input()) for _ in range(Q)] querys [int(input()) for _ in range(Q)] time = [-1] * Q time [-1] * Q [-1] -1 Q jump = [-1] * Q jump [-1] * Q [-1] -1 Q check_points = sorted(check_points, key=itemgetter(2)) check_points sorted(check_points, key=itemgetter(2)) sorted check_points key=itemgetter(2) key itemgetter(2) itemgetter 2 b_left = bisect_left b_left bisect_left for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left] line check_points s, f, x = line s line f x start = s-x start s-x s x end = f-x end f-x f x left = b_left(querys, start) left b_left(querys, start) b_left querys start right = b_left(querys, end) right b_left(querys, end) b_left querys end while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left] left < right left right if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left] time[left] == -1 time[left] time left -1 time[left] = x time[left] time left x jump[left] = right jump[left] jump left right left += 1 left 1 left = jump[left] left jump[left] jump left for t in time:
    print(t) t time print(t) print t querys = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] querys N, Q = map(int, input().split(" ")) map(int, input().split(" ")) N time = [-1] * Q [-1] * Q time end = f-x f-x end left = jump[left] jump[left] left start = s-x s-x start right = b_left(querys, end) b_left(querys, end) right left += 1 1 left input = sys.stdin.readline sys.stdin.readline input x = line line x Q = map(int, input().split(" ")) map(int, input().split(" ")) Q f, x = line line f b_left = bisect_left bisect_left b_left check_points = sorted(check_points, key=itemgetter(2)) sorted(check_points, key=itemgetter(2)) check_points check_points = [tuple(map(int, input().split(" "))) for _ in range(N)] [tuple(map(int, input().split(" "))) for _ in range(N)] check_points jump = [-1] * Q [-1] * Q jump left = b_left(querys, start) b_left(querys, start) left s, f, x = line line s
from bisect import bisect_left
from operator import itemgetter
import sys

input = sys.stdin.readline

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1] * Q
jump = [-1] * Q
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t)
