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

E = []
F = {}
for i in range(n):
    s = A[i][0]
    t = A[i][1]
    x = A[i][2]
    F[x] = 0
    E.append((s-x, x, 1))
    E.append((t-x, x, -1))
E.append((10**10, 10**10, 1))

E.sort()

# print(E)

from heapq import heappush, heappop
Q = []

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

E = []
F = {}
for i in range(n):
    s = A[i][0]
    t = A[i][1]
    x = A[i][2]
    F[x] = 0
    E.append((s-x, x, 1))
    E.append((t-x, x, -1))
E.append((10**10, 10**10, 1))

E.sort()

# print(E)

from heapq import heappush, heappop
Q = []

j = 0
for i in range(q):
    # print(F,j)
    while E[j][0] <= D[i]:
        if E[j][2] == 1:
            F[E[j][1]] += 1
            heappush(Q, E[j][1])
        else:
            F[E[j][1]] -= 1
        j += 1
    
    while len(Q) > 0 and F[Q[0]] == 0:
        _ = heappop(Q)
    if len(Q) == 0:
        print(-1)
    else:
        print(Q[0])
