import sys
from bisect import bisect_left

input = sys.stdin.readline
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

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

ans = [-1] * q
jump = [-1] * q
for s, t, x in stx:
    d_start = bisect_left(d, s - x)
    d_stop = bisect_left(d, t - x, lo=d_start)
    while d_start < d_stop:
        if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start]

for an in ans:
    print(an) import sys sys from bisect import bisect_left 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 stx = [tuple(map(int, input().split())) for _ in range(n)] stx [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 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 jump = [-1] * q jump [-1] * q [-1] -1 q for s, t, x in stx:
    d_start = bisect_left(d, s - x)
    d_stop = bisect_left(d, t - x, lo=d_start)
    while d_start < d_stop:
        if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start] s t x stx d_start = bisect_left(d, s - x) d_start bisect_left(d, s - x) bisect_left d s - x s x d_stop = bisect_left(d, t - x, lo=d_start) d_stop bisect_left(d, t - x, lo=d_start) bisect_left d t - x t x lo=d_start lo d_start while d_start < d_stop:
        if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start] d_start < d_stop d_start d_stop if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start] jump[d_start] == -1 jump[d_start] jump d_start -1 ans[d_start] = x ans[d_start] ans d_start x jump[d_start] = d_stop jump[d_start] jump d_start d_stop d_start += 1 d_start 1 d_start = jump[d_start] d_start jump[d_start] jump d_start for an in ans:
    print(an) an ans print(an) print an d_start = bisect_left(d, s - x) bisect_left(d, s - x) d_start n, q = map(int, input().split()) map(int, input().split()) n d_start += 1 1 d_start d_stop = bisect_left(d, t - x, lo=d_start) bisect_left(d, t - x, lo=d_start) d_stop ans = [-1] * q [-1] * q ans input = sys.stdin.readline sys.stdin.readline input stx = [tuple(map(int, input().split())) for _ in range(n)] [tuple(map(int, input().split())) for _ in range(n)] stx d = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] d jump = [-1] * q [-1] * q jump d_start = jump[d_start] jump[d_start] d_start q = map(int, input().split()) map(int, input().split()) q
import sys
from bisect import bisect_left

input = sys.stdin.readline
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

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

ans = [-1] * q
jump = [-1] * q
for s, t, x in stx:
    d_start = bisect_left(d, s - x)
    d_stop = bisect_left(d, t - x, lo=d_start)
    while d_start < d_stop:
        if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start]

for an in ans:
    print(an)
