import sys
input = sys.stdin.readline
from bisect import bisect_left

# 区間更新 1点取得
class SegmentTree:
    def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
    def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

    def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res



def main():
    N, Q = map(int, input().split())
    road = []
    for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

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

    st = SegmentTree(Q)
    for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

    for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans)

if __name__ == "__main__":
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left class SegmentTree:
    def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
    def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

    def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res SegmentTree def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
     __init__ tmp = 1 tmp 1 while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
         tmp < N tmp N tmp <<= 1 tmp 1 self.N = tmp self.N self N tmp float('inf') for _ in range(2*self.N) for _ in range(2*self.N) _ range(2*self.N) range 2*self.N 2 self.N self N for _ in range(2*self.N) float('inf') float 'inf' self.data = [float('inf') for _ in range(2*self.N)] self.data self data [float('inf') for _ in range(2*self.N)] self self N N def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

     update L = l + self.N L l + self.N l self.N self N R = r + self.N R r + self.N r self.N self N while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

     L < R L R if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
             L & 1 L 1 self.data[L] = min([self.data[L], x]) self.data[L] self.data self data L min([self.data[L], x]) min [self.data[L], x] self.data[L] self.data self data L x L += 1 L 1 if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
             R & 1 R 1 R -= 1 R 1 self.data[R] = min([self.data[R], x]) self.data[R] self.data self data R min([self.data[R], x]) min [self.data[R], x] self.data[R] self.data self data R x L >>= 1 L 1 R >>= 1 R 1 self self l l r r x x def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res query k += self.N k self.N self N res = self.data[k] res self.data[k] self.data self data k while k != 1:
            k >>= 1
            res = min(res, self.data[k])
         k != 1 k 1 k >>= 1 k 1 res = min(res, self.data[k]) res min(res, self.data[k]) min res self.data[k] self.data self data k return res res self self k k def main():
    N, Q = map(int, input().split())
    road = []
    for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

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

    st = SegmentTree(Q)
    for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

    for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans) main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q road = [] road [] for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

     _ range(N) range N S, T, X = map(int, input().split()) S map(int, input().split()) map int input().split() ().split () input split T X road.append((S,T,X)) road.append road append (S,T,X) S T X 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)] st = SegmentTree(Q) st SegmentTree(Q) SegmentTree Q for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

     S T X road l = bisect_left(D, S - X) l bisect_left(D, S - X) bisect_left D S - X S X r = bisect_left(D, T - X) r bisect_left(D, T - X) bisect_left D T - X T X st.update(l, r, X) st.update st update l r X for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans) q range(Q) range Q ans = st.query(q) ans st.query(q) st.query st query q if ans == float('inf'):
            print(-1)
        else:
            print(ans) ans == float('inf') ans float('inf') float 'inf' print(-1) print -1 print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N, Q = map(int, input().split())
    road = []
    for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

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

    st = SegmentTree(Q)
    for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

    for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans) def main():
    N, Q = map(int, input().split())
    road = []
    for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

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

    st = SegmentTree(Q)
    for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

    for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans) main input = sys.stdin.readline sys.stdin.readline input class SegmentTree:
    def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
    def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

    def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res class SegmentTree:
    def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
    def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

    def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res SegmentTree
import sys
input = sys.stdin.readline
from bisect import bisect_left

# 区間更新 1点取得
class SegmentTree:
    def __init__(self, N):
        tmp = 1
        while tmp < N:
            tmp <<= 1
        # self.N : 完全二分木の葉の数(N以上の最小の2べき)
        self.N = tmp
        # 2*self.N - 1 : 完全二分木のノード数
        # 1-indexedで管理するので1プラス
        self.data = [float('inf') for _ in range(2*self.N)]

    # [l, r)
    # 入力は0-indexedなので注意
    def update(self, l, r, x):
        L = l + self.N
        R = r + self.N
        while L < R:
            if L & 1:
                self.data[L] = min([self.data[L], x])
                L += 1
            if R & 1:
                R -= 1
                self.data[R] = min([self.data[R], x])
            L >>= 1
            R >>= 1

    def query(self, k):
        k += self.N
        res = self.data[k]
        while k != 1:
            k >>= 1
            res = min(res, self.data[k])
        return res



def main():
    N, Q = map(int, input().split())
    road = []
    for _ in range(N):
        S, T, X = map(int, input().split())
        road.append((S,T,X))

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

    st = SegmentTree(Q)
    for S, T, X in road:
        l = bisect_left(D, S - X)
        r = bisect_left(D, T - X)
        st.update(l, r, X)

    for q in range(Q):
        ans = st.query(q)
        if ans == float('inf'):
            print(-1)
        else:
            print(ans)

if __name__ == "__main__":
    main()