import sys
input = sys.stdin.readline
n, q = map(int,input().split())
S = [list(map(int,input().split())) for i in range(n)]
D = [int(input()) for i in range(q)]

A = []
for i in range(n):
    s = S[i][0]
    t = S[i][1]
    x = S[i][2]
    A.append([s-x-0.5, x, i, 0])
    A.append([t-x-0.5, x, i, 1])
for i in range(q):
    A.append([D[i], 0, 0, 2])

A.sort()
from heapq import heappop, heappush
Q = []
F = [0] * n
for i in range(len(A)):
    s = A[i][0]
    x = A[i][1]
    j = A[i][2]
    f = A[i][3]
    if f == 0:
        heappush(Q, [x, j])
        F[j] = 1
    elif f == 1:
        F[j] = 0
    elif f == 2:
        while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
        if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1) 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 list(map(int,input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split S = [list(map(int,input().split())) for i in range(n)] S [list(map(int,input().split())) for i in range(n)] int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input D = [int(input()) for i in range(q)] D [int(input()) for i in range(q)] A = [] A [] for i in range(n):
    s = S[i][0]
    t = S[i][1]
    x = S[i][2]
    A.append([s-x-0.5, x, i, 0])
    A.append([t-x-0.5, x, i, 1]) i range(n) range n s = S[i][0] s S[i][0] [i] S i 0 t = S[i][1] t S[i][1] [i] S i 1 x = S[i][2] x S[i][2] [i] S i 2 A.append([s-x-0.5, x, i, 0]) A.append A append [s-x-0.5, x, i, 0] s-x-0.5 s-x s x 0.5 x i 0 A.append([t-x-0.5, x, i, 1]) A.append A append [t-x-0.5, x, i, 1] t-x-0.5 t-x t x 0.5 x i 1 for i in range(q):
    A.append([D[i], 0, 0, 2]) i range(q) range q A.append([D[i], 0, 0, 2]) A.append A append [D[i], 0, 0, 2] D[i] D i 0 0 2 A.sort() A.sort A sort from heapq import heappop, heappush Q = [] Q [] F = [0] * n F [0] * n [0] 0 n for i in range(len(A)):
    s = A[i][0]
    x = A[i][1]
    j = A[i][2]
    f = A[i][3]
    if f == 0:
        heappush(Q, [x, j])
        F[j] = 1
    elif f == 1:
        F[j] = 0
    elif f == 2:
        while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
        if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1) i range(len(A)) range len(A) len A s = A[i][0] s A[i][0] [i] A i 0 x = A[i][1] x A[i][1] [i] A i 1 j = A[i][2] j A[i][2] [i] A i 2 f = A[i][3] f A[i][3] [i] A i 3 if f == 0:
        heappush(Q, [x, j])
        F[j] = 1
    elif f == 1:
        F[j] = 0
    elif f == 2:
        while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
        if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1) f == 0 f 0 heappush(Q, [x, j]) heappush Q [x, j] x j F[j] = 1 F[j] F j 1 elif f == 1:
        F[j] = 0
     f == 1 f 1 F[j] = 0 F[j] F j 0 elif f == 2:
        while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
        if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1) f == 2 f 2 while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
         len(Q) > 0 and F[Q[0][1]] == 0 len(Q) > 0 len(Q) len Q 0 F[Q[0][1]] == 0 F[Q[0][1]] F Q[0][1] [0] Q 0 1 0 heappop(Q) heappop Q if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1) len(Q) > 0 len(Q) len Q 0 print(Q[0][0]) print Q[0][0] [0] Q 0 0 print(-1) print -1 x = S[i][2] S[i][2] x j = A[i][2] A[i][2] j S = [list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] S t = S[i][1] S[i][1] t s = S[i][0] S[i][0] s q = map(int,input().split()) map(int,input().split()) q f = A[i][3] A[i][3] f F = [0] * n [0] * n F s = A[i][0] A[i][0] s n, q = map(int,input().split()) map(int,input().split()) n A = [] [] A input = sys.stdin.readline sys.stdin.readline input D = [int(input()) for i in range(q)] [int(input()) for i in range(q)] D x = A[i][1] A[i][1] x Q = [] [] Q
import sys
input = sys.stdin.readline
n, q = map(int,input().split())
S = [list(map(int,input().split())) for i in range(n)]
D = [int(input()) for i in range(q)]

A = []
for i in range(n):
    s = S[i][0]
    t = S[i][1]
    x = S[i][2]
    A.append([s-x-0.5, x, i, 0])
    A.append([t-x-0.5, x, i, 1])
for i in range(q):
    A.append([D[i], 0, 0, 2])

A.sort()
from heapq import heappop, heappush
Q = []
F = [0] * n
for i in range(len(A)):
    s = A[i][0]
    x = A[i][1]
    j = A[i][2]
    f = A[i][3]
    if f == 0:
        heappush(Q, [x, j])
        F[j] = 1
    elif f == 1:
        F[j] = 0
    elif f == 2:
        while len(Q) > 0 and F[Q[0][1]] == 0:
            heappop(Q)
        if len(Q) > 0:
            print(Q[0][0])
        else:
            print(-1)
