import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
    




    
     import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q S = [None] * N S [None] * N [None] None N T = [None] * N T [None] * N [None] None N X = [None] * N X [None] * N [None] None N for i in range(N):
    S[i], T[i], X[i] = map(int, input().split()) i range(N) range N S[i], T[i], X[i] = map(int, input().split()) S[i] S i map(int, input().split()) map int input().split() ().split () input split T[i] T i X[i] X i D = [None] * Q D [None] * Q [None] None Q for i in range(Q):
    D[i] = int(input())
    
# X S T i range(Q) range Q D[i] = int(input()) D[i] D i int(input()) int input() input (x, s, t) for x, s, t in zip(X, S, T) for x, s, t in zip(X, S, T) x s t zip(X, S, T) zip X S T for x, s, t in zip(X, S, T) (x, s, t) x s t roadworks = [(x, s, t) for x, s, t in zip(X, S, T)] roadworks [(x, s, t) for x, s, t in zip(X, S, T)] roadworks = sorted(roadworks, key=lambda x: x[0]) roadworks sorted(roadworks, key=lambda x: x[0]) sorted roadworks key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x walkers = D[:] walkers D[:] D : ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q import bisect bisect for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers) x s t roadworks left = bisect.bisect_left(walkers, s - x) left bisect.bisect_left(walkers, s - x) bisect.bisect_left bisect bisect_left walkers s - x s x right = bisect.bisect_left(walkers, t - x) right bisect.bisect_left(walkers, t - x) bisect.bisect_left bisect bisect_left walkers t - x t x i = left i left while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers) i < right i right if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers) skip[i] == -1 skip[i] skip i -1 ans[i] = x ans[i] ans i x skip[i] = right skip[i] skip i right i += 1 i 1 i = skip[i] i skip[i] skip i for a in ans:
    print(a)
    




    
     a ans print(a) print a T = [None] * N [None] * N T skip = [-1] * Q [-1] * Q skip i += 1 1 i roadworks = sorted(roadworks, key=lambda x: x[0]) sorted(roadworks, key=lambda x: x[0]) roadworks i = skip[i] skip[i] i N, Q = map(int, input().split()) map(int, input().split()) N S = [None] * N [None] * N S roadworks = [(x, s, t) for x, s, t in zip(X, S, T)] [(x, s, t) for x, s, t in zip(X, S, T)] roadworks left = bisect.bisect_left(walkers, s - x) bisect.bisect_left(walkers, s - x) left Q = map(int, input().split()) map(int, input().split()) Q input = sys.stdin.readline sys.stdin.readline input D = [None] * Q [None] * Q D ans = [-1] * Q [-1] * Q ans right = bisect.bisect_left(walkers, t - x) bisect.bisect_left(walkers, t - x) right X = [None] * N [None] * N X i = left left i walkers = D[:] D[:] walkers
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
    




    
    
