import heapq
import sys
input = sys.stdin.readline

N, Q = (int(i) for i in input().split())
L = [0] * 2 * N
for i in range(N):
    S, T, X = (int(i) for i in input().split())
    L[2 * i] = (S-X, X, 1)
    L[2 * i + 1] = (T-X, X, 0)

L.sort(reverse=True)

Xs = set([])
XH = []
heapq.heapify(XH)
for i in range(Q):
    D = int(input())
    ans = 0
    while True:
        if L:
            t, X, f = L.pop()
            if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
        else:
            break
    if Xs:
        while XH[0] not in Xs:
            X = heapq.heappop(XH)
        print(XH[0])
    else:
        print("-1") import heapq heapq import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N, Q = (int(i) for i in input().split()) N (int(i) for i in input().split()) Q L = [0] * 2 * N L [0] * 2 * N [0] * 2 [0] 0 2 N for i in range(N):
    S, T, X = (int(i) for i in input().split())
    L[2 * i] = (S-X, X, 1)
    L[2 * i + 1] = (T-X, X, 0) i range(N) range N int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i S, T, X = (int(i) for i in input().split()) S (int(i) for i in input().split()) T X L[2 * i] = (S-X, X, 1) L[2 * i] L 2 * i 2 i (S-X, X, 1) S-X S X X 1 L[2 * i + 1] = (T-X, X, 0) L[2 * i + 1] L 2 * i + 1 2 * i 2 i 1 (T-X, X, 0) T-X T X X 0 L.sort(reverse=True) L.sort L sort reverse=True reverse True Xs = set([]) Xs set([]) set [] XH = [] XH [] heapq.heapify(XH) heapq.heapify heapq heapify XH for i in range(Q):
    D = int(input())
    ans = 0
    while True:
        if L:
            t, X, f = L.pop()
            if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
        else:
            break
    if Xs:
        while XH[0] not in Xs:
            X = heapq.heappop(XH)
        print(XH[0])
    else:
        print("-1") i range(Q) range Q D = int(input()) D int(input()) int input() input ans = 0 ans 0 while True:
        if L:
            t, X, f = L.pop()
            if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
        else:
            break
     True if L:
            t, X, f = L.pop()
            if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
        else:
            break
     L t, X, f = L.pop() t L.pop() L.pop L pop X f if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
         t <= D t D if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
             f == 1 f 1 Xs.add(X) Xs.add Xs add X heapq.heappush(XH, X) heapq.heappush heapq heappush XH X Xs.remove(X) Xs.remove Xs remove X L.append((t, X, f)) L.append L append (t, X, f) t X f break break if Xs:
        while XH[0] not in Xs:
            X = heapq.heappop(XH)
        print(XH[0])
    else:
        print("-1") Xs while XH[0] not in Xs:
            X = heapq.heappop(XH)
         XH[0] not in Xs XH[0] XH 0 Xs X = heapq.heappop(XH) X heapq.heappop(XH) heapq.heappop heapq heappop XH print(XH[0]) print XH[0] XH 0 print("-1") print "-1" N, Q = (int(i) for i in input().split()) (int(i) for i in input().split()) N ans = 0 0 ans D = int(input()) int(input()) D X = (int(i) for i in input().split()) (int(i) for i in input().split()) X S, T, X = (int(i) for i in input().split()) (int(i) for i in input().split()) S t, X, f = L.pop() L.pop() t L = [0] * 2 * N [0] * 2 * N L T, X = (int(i) for i in input().split()) (int(i) for i in input().split()) T input = sys.stdin.readline sys.stdin.readline input f = L.pop() L.pop() f X = heapq.heappop(XH) heapq.heappop(XH) X Xs = set([]) set([]) Xs XH = [] [] XH Q = (int(i) for i in input().split()) (int(i) for i in input().split()) Q X, f = L.pop() L.pop() X
import heapq
import sys
input = sys.stdin.readline

N, Q = (int(i) for i in input().split())
L = [0] * 2 * N
for i in range(N):
    S, T, X = (int(i) for i in input().split())
    L[2 * i] = (S-X, X, 1)
    L[2 * i + 1] = (T-X, X, 0)

L.sort(reverse=True)

Xs = set([])
XH = []
heapq.heapify(XH)
for i in range(Q):
    D = int(input())
    ans = 0
    while True:
        if L:
            t, X, f = L.pop()
            if t <= D:
                if f == 1:
                    Xs.add(X)
                    heapq.heappush(XH, X)
                else:
                    Xs.remove(X)
            else:
                L.append((t, X, f))
                break
        else:
            break
    if Xs:
        while XH[0] not in Xs:
            X = heapq.heappop(XH)
        print(XH[0])
    else:
        print("-1")