import sys
input = sys.stdin.readline

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

Xs = set([])
XH = []
heapq.heapify(XH)
for t, f, X in L:
    if f == 1:
        Xs.add(X)
        heapq.heappush(XH, X)
    elif  f == -1:
        Xs.remove(X)
    else:
        if Xs:
            while XH[0] not in Xs:
                X = heapq.heappop(XH)
            print(XH[0])
        else:
            print("-1") import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import heapq heapq 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 + Q) L [0] * (2 * N + Q) [0] 0 2 * N + Q 2 * N 2 N Q for i in range(N):
    S, T, X = (int(i) for i in input().split())
    L[2 * i] = (S-X, 1, X)
    L[2 * i + 1] = (T-X, -1, X) 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, 1, X) L[2 * i] L 2 * i 2 i (S-X, 1, X) S-X S X 1 X L[2 * i + 1] = (T-X, -1, X) L[2 * i + 1] L 2 * i + 1 2 * i 2 i 1 (T-X, -1, X) T-X T X -1 X for i in range(Q):
    D = int(input())
    L[2 * N + i] = (D, 2, 0) i range(Q) range Q D = int(input()) D int(input()) int input() input L[2 * N + i] = (D, 2, 0) L[2 * N + i] L 2 * N + i 2 * N 2 N i (D, 2, 0) D 2 0 L.sort() L.sort L sort Xs = set([]) Xs set([]) set [] XH = [] XH [] heapq.heapify(XH) heapq.heapify heapq heapify XH for t, f, X in L:
    if f == 1:
        Xs.add(X)
        heapq.heappush(XH, X)
    elif  f == -1:
        Xs.remove(X)
    else:
        if Xs:
            while XH[0] not in Xs:
                X = heapq.heappop(XH)
            print(XH[0])
        else:
            print("-1") t f X L if f == 1:
        Xs.add(X)
        heapq.heappush(XH, X)
    elif  f == -1:
        Xs.remove(X)
    else:
        if Xs:
            while XH[0] not in Xs:
                X = heapq.heappop(XH)
            print(XH[0])
        else:
            print("-1") f == 1 f 1 Xs.add(X) Xs.add Xs add X heapq.heappush(XH, X) heapq.heappush heapq heappush XH X elif  f == -1:
        Xs.remove(X)
     f == -1 f -1 Xs.remove(X) Xs.remove Xs remove X 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" input = sys.stdin.readline sys.stdin.readline input N, Q = (int(i) for i in input().split()) (int(i) for i in input().split()) N X = (int(i) for i in input().split()) (int(i) for i in input().split()) X Q = (int(i) for i in input().split()) (int(i) for i in input().split()) Q L = [0] * (2 * N + Q) [0] * (2 * N + Q) L Xs = set([]) set([]) Xs T, X = (int(i) for i in input().split()) (int(i) for i in input().split()) T X = heapq.heappop(XH) heapq.heappop(XH) X S, T, X = (int(i) for i in input().split()) (int(i) for i in input().split()) S XH = [] [] XH D = int(input()) int(input()) D
import sys
input = sys.stdin.readline

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

Xs = set([])
XH = []
heapq.heapify(XH)
for t, f, X in L:
    if f == 1:
        Xs.add(X)
        heapq.heappush(XH, X)
    elif  f == -1:
        Xs.remove(X)
    else:
        if Xs:
            while XH[0] not in Xs:
                X = heapq.heappop(XH)
            print(XH[0])
        else:
            print("-1")