import bisect
import sys
input = sys.stdin.readline


n, q = map(int, input().split())
events = [list(map(int, input().split())) for _ in range(n)]
events.sort(key=lambda x: x[2])

departures = [int(input()) for _ in range(q)]


ans = ['-1'] * q
skip = [-1] * q

for start, end, pos in events:
    left = bisect.bisect_left(departures, start-pos)
    right = bisect.bisect_left(departures, end-pos)

    while left < right:
        if skip[left] == -1:
            ans[left] = str(pos)
            skip[left] = right
            left += 1

        else:
            left = skip[left]

print('\n'.join(ans)) import bisect bisect 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 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 events = [list(map(int, input().split())) for _ in range(n)] events [list(map(int, input().split())) for _ in range(n)] events.sort(key=lambda x: x[2]) events.sort events 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 departures = [int(input()) for _ in range(q)] departures [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 start, end, pos in events:
    left = bisect.bisect_left(departures, start-pos)
    right = bisect.bisect_left(departures, end-pos)

    while left < right:
        if skip[left] == -1:
            ans[left] = str(pos)
            skip[left] = right
            left += 1

        else:
            left = skip[left] start end pos events left = bisect.bisect_left(departures, start-pos) left bisect.bisect_left(departures, start-pos) bisect.bisect_left bisect bisect_left departures start-pos start pos right = bisect.bisect_left(departures, end-pos) right bisect.bisect_left(departures, end-pos) bisect.bisect_left bisect bisect_left departures end-pos end pos while left < right:
        if skip[left] == -1:
            ans[left] = str(pos)
            skip[left] = right
            left += 1

        else:
            left = skip[left] left < right left right if skip[left] == -1:
            ans[left] = str(pos)
            skip[left] = right
            left += 1

        else:
            left = skip[left] skip[left] == -1 skip[left] skip left -1 ans[left] = str(pos) ans[left] ans left str(pos) str pos skip[left] = right skip[left] skip left right left += 1 left 1 left = skip[left] left skip[left] skip left print('\n'.join(ans)) print '\n'.join(ans) '\n'.join '\n' join ans left = bisect.bisect_left(departures, start-pos) bisect.bisect_left(departures, start-pos) left left = skip[left] skip[left] left n, q = map(int, input().split()) map(int, input().split()) n events = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] events skip = [-1] * q [-1] * q skip q = map(int, input().split()) map(int, input().split()) q input = sys.stdin.readline sys.stdin.readline input departures = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] departures ans = ['-1'] * q ['-1'] * q ans left += 1 1 left right = bisect.bisect_left(departures, end-pos) bisect.bisect_left(departures, end-pos) right
import bisect
import sys
input = sys.stdin.readline


n, q = map(int, input().split())
events = [list(map(int, input().split())) for _ in range(n)]
events.sort(key=lambda x: x[2])

departures = [int(input()) for _ in range(q)]


ans = ['-1'] * q
skip = [-1] * q

for start, end, pos in events:
    left = bisect.bisect_left(departures, start-pos)
    right = bisect.bisect_left(departures, end-pos)

    while left < right:
        if skip[left] == -1:
            ans[left] = str(pos)
            skip[left] = right
            left += 1

        else:
            left = skip[left]

print('\n'.join(ans))
