# https://atcoder.jp/contests/abc128/submissions/7097699
import sys
input = sys.stdin.readline

from bisect import bisect_left

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

skip = [-1]*q
ans = [-1]*q
for s,t,x in road:
    left = bisect_left(start, s-x)
    right = bisect_left(start, t-x)
    # [left, right)をxで埋める
    # すでに存在するところ(skipがあるところ)は飛ばす
    while left < right:
        if skip[left] == -1:
            ans[left] = x
            skip[left] = right
            left += 1
        else:
            left = skip[left]
print(*ans, sep="\n") import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left 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 i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split road = [list(map(int, input().split())) for i in range(n)] road [list(map(int, input().split())) for i in range(n)] road.sort(key=lambda x: x[2]) road.sort road sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input start = [int(input()) for i in range(q)] start [int(input()) for i in range(q)] skip = [-1]*q skip [-1]*q [-1] -1 q ans = [-1]*q ans [-1]*q [-1] -1 q for s,t,x in road:
    left = bisect_left(start, s-x)
    right = bisect_left(start, t-x)
    # [left, right)をxで埋める
    # すでに存在するところ(skipがあるところ)は飛ばす
    while left < right:
        if skip[left] == -1:
            ans[left] = x
            skip[left] = right
            left += 1
        else:
            left = skip[left] s t x road left = bisect_left(start, s-x) left bisect_left(start, s-x) bisect_left start s-x s x right = bisect_left(start, t-x) right bisect_left(start, t-x) bisect_left start t-x t x while left < right:
        if skip[left] == -1:
            ans[left] = x
            skip[left] = right
            left += 1
        else:
            left = skip[left] left < right left right if skip[left] == -1:
            ans[left] = x
            skip[left] = right
            left += 1
        else:
            left = skip[left] skip[left] == -1 skip[left] skip left -1 ans[left] = x ans[left] ans left x skip[left] = right skip[left] skip left right left += 1 left 1 left = skip[left] left skip[left] skip left print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" q = map(int, input().split()) map(int, input().split()) q left = skip[left] skip[left] left n,q = map(int, input().split()) map(int, input().split()) n skip = [-1]*q [-1]*q skip input = sys.stdin.readline sys.stdin.readline input start = [int(input()) for i in range(q)] [int(input()) for i in range(q)] start ans = [-1]*q [-1]*q ans left = bisect_left(start, s-x) bisect_left(start, s-x) left road = [list(map(int, input().split())) for i in range(n)] [list(map(int, input().split())) for i in range(n)] road left += 1 1 left right = bisect_left(start, t-x) bisect_left(start, t-x) right
# https://atcoder.jp/contests/abc128/submissions/7097699
import sys
input = sys.stdin.readline

from bisect import bisect_left

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

skip = [-1]*q
ans = [-1]*q
for s,t,x in road:
    left = bisect_left(start, s-x)
    right = bisect_left(start, t-x)
    # [left, right)をxで埋める
    # すでに存在するところ(skipがあるところ)は飛ばす
    while left < right:
        if skip[left] == -1:
            ans[left] = x
            skip[left] = right
            left += 1
        else:
            left = skip[left]
print(*ans, sep="\n")