import bisect
n, q = map(int, input().split())
STX = []
for i in range(n):
    s, t, x = map(int, input().split())
    STX.append((s, t, x))
STX.sort(key=lambda _: _[2])
S, T, X = [], [], []
for stx in STX:
    s, t, x = stx
    S.append(s)
    T.append(t)
    X.append(x)
D = [int(input()) for j in range(q)]
A = [-1 for j in range(q)]
B = [-1 for j in range(q)]
for i in range(n):
    l = bisect.bisect_left(D, S[i]-X[i])
    r = bisect.bisect_left(D, T[i]-X[i])
    while l < r:
        if B[l] == -1:
            A[l] = X[i]
            B[l] = r
            l += 1
        else:
            l = B[l]
print(*A, sep='\n') import bisect bisect n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q STX = [] STX [] for i in range(n):
    s, t, x = map(int, input().split())
    STX.append((s, t, x)) i 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 STX.append((s, t, x)) STX.append STX append (s, t, x) s t x STX.sort(key=lambda _: _[2]) STX.sort STX sort key=lambda _: _[2] key lambda _: _[2] _[2] _ 2 _ S, T, X = [], [], [] S [] T [] X [] for stx in STX:
    s, t, x = stx
    S.append(s)
    T.append(t)
    X.append(x) stx STX s, t, x = stx s stx t x S.append(s) S.append S append s T.append(t) T.append T append t X.append(x) X.append X append x int(input()) for j in range(q) for j in range(q) j range(q) range q for j in range(q) int(input()) int input() input D = [int(input()) for j in range(q)] D [int(input()) for j in range(q)] -1 for j in range(q) for j in range(q) j range(q) range q for j in range(q) -1 A = [-1 for j in range(q)] A [-1 for j in range(q)] -1 for j in range(q) for j in range(q) j range(q) range q for j in range(q) -1 B = [-1 for j in range(q)] B [-1 for j in range(q)] for i in range(n):
    l = bisect.bisect_left(D, S[i]-X[i])
    r = bisect.bisect_left(D, T[i]-X[i])
    while l < r:
        if B[l] == -1:
            A[l] = X[i]
            B[l] = r
            l += 1
        else:
            l = B[l] i range(n) range n l = bisect.bisect_left(D, S[i]-X[i]) l bisect.bisect_left(D, S[i]-X[i]) bisect.bisect_left bisect bisect_left D S[i]-X[i] S[i] S i X[i] X i r = bisect.bisect_left(D, T[i]-X[i]) r bisect.bisect_left(D, T[i]-X[i]) bisect.bisect_left bisect bisect_left D T[i]-X[i] T[i] T i X[i] X i while l < r:
        if B[l] == -1:
            A[l] = X[i]
            B[l] = r
            l += 1
        else:
            l = B[l] l < r l r if B[l] == -1:
            A[l] = X[i]
            B[l] = r
            l += 1
        else:
            l = B[l] B[l] == -1 B[l] B l -1 A[l] = X[i] A[l] A l X[i] X i B[l] = r B[l] B l r l += 1 l 1 l = B[l] l B[l] B l print(*A, sep='\n') print *A A sep='\n' sep '\n' q = map(int, input().split()) map(int, input().split()) q S, T, X = [], [], [] [] S x = map(int, input().split()) map(int, input().split()) x r = bisect.bisect_left(D, T[i]-X[i]) bisect.bisect_left(D, T[i]-X[i]) r l += 1 1 l STX = [] [] STX s, t, x = map(int, input().split()) map(int, input().split()) s t, x = map(int, input().split()) map(int, input().split()) t T, X = [], [], [] [] T D = [int(input()) for j in range(q)] [int(input()) for j in range(q)] D x = stx stx x A = [-1 for j in range(q)] [-1 for j in range(q)] A l = B[l] B[l] l n, q = map(int, input().split()) map(int, input().split()) n t, x = stx stx t l = bisect.bisect_left(D, S[i]-X[i]) bisect.bisect_left(D, S[i]-X[i]) l s, t, x = stx stx s X = [], [], [] [] X B = [-1 for j in range(q)] [-1 for j in range(q)] B
import bisect
n, q = map(int, input().split())
STX = []
for i in range(n):
    s, t, x = map(int, input().split())
    STX.append((s, t, x))
STX.sort(key=lambda _: _[2])
S, T, X = [], [], []
for stx in STX:
    s, t, x = stx
    S.append(s)
    T.append(t)
    X.append(x)
D = [int(input()) for j in range(q)]
A = [-1 for j in range(q)]
B = [-1 for j in range(q)]
for i in range(n):
    l = bisect.bisect_left(D, S[i]-X[i])
    r = bisect.bisect_left(D, T[i]-X[i])
    while l < r:
        if B[l] == -1:
            A[l] = X[i]
            B[l] = r
            l += 1
        else:
            l = B[l]
print(*A, sep='\n')
