import bisect
import heapq
import sys
N,Q = [int(x) for x in sys.stdin.readline().split()]

hitos = []
ans = [-1 for _ in range(Q)]
queries =[]
jump = ans[::]



queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)]
hitos = [int(sys.stdin.readline()) for i in range(Q)]


# for i in range(N):
    # S,T,X =list(map(int,input().split(" ")))
    # lt = S -X -0.5
    # rt = T -X -0.5
    # queries.append([lt,rt,X]) #-1 → 挿入クエリ lが時間、-1がクエリの種類、Xが場所


queries.sort(key=lambda x:x[2])





for l,r,x in queries:
     lind  = bisect.bisect_left(hitos,l-x - 0.5)
     rind  = bisect.bisect_left(hitos,r -x - 0.5)
     while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:

             lind = jump[lind]

for i  in ans:
    print(i) import bisect bisect import heapq heapq import sys sys int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x N,Q = [int(x) for x in sys.stdin.readline().split()] N [int(x) for x in sys.stdin.readline().split()] Q hitos = [] hitos [] -1 for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) -1 ans = [-1 for _ in range(Q)] ans [-1 for _ in range(Q)] queries =[] queries [] jump = ans[::] jump ans[::] ans :: [int(x) for x in sys.stdin.readline().split()] for i in range(N) for i in range(N) i range(N) range N for i in range(N) [int(x) for x in sys.stdin.readline().split()] queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)] queries [[int(x) for x in sys.stdin.readline().split()] for i in range(N)] int(sys.stdin.readline()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline hitos = [int(sys.stdin.readline()) for i in range(Q)] hitos [int(sys.stdin.readline()) for i in range(Q)] queries.sort(key=lambda x:x[2]) queries.sort queries sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x for l,r,x in queries:
     lind  = bisect.bisect_left(hitos,l-x - 0.5)
     rind  = bisect.bisect_left(hitos,r -x - 0.5)
     while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:

             lind = jump[lind] l r x queries lind  = bisect.bisect_left(hitos,l-x - 0.5) lind bisect.bisect_left(hitos,l-x - 0.5) bisect.bisect_left bisect bisect_left hitos l-x - 0.5 l-x l x 0.5 rind  = bisect.bisect_left(hitos,r -x - 0.5) rind bisect.bisect_left(hitos,r -x - 0.5) bisect.bisect_left bisect bisect_left hitos r -x - 0.5 r -x r x 0.5 while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:

             lind = jump[lind] lind < rind lind rind if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:

             lind = jump[lind] ans[lind] == -1 ans[lind] ans lind -1 ans[lind] = x ans[lind] ans lind x jump[lind] = rind jump[lind] jump lind rind lind += 1 lind 1 lind = jump[lind] lind jump[lind] jump lind for i  in ans:
    print(i) i ans print(i) print i jump = ans[::] ans[::] jump Q = [int(x) for x in sys.stdin.readline().split()] [int(x) for x in sys.stdin.readline().split()] Q rind  = bisect.bisect_left(hitos,r -x - 0.5) bisect.bisect_left(hitos,r -x - 0.5) rind queries =[] [] queries hitos = [int(sys.stdin.readline()) for i in range(Q)] [int(sys.stdin.readline()) for i in range(Q)] hitos lind += 1 1 lind N,Q = [int(x) for x in sys.stdin.readline().split()] [int(x) for x in sys.stdin.readline().split()] N ans = [-1 for _ in range(Q)] [-1 for _ in range(Q)] ans lind = jump[lind] jump[lind] lind hitos = [] [] hitos lind  = bisect.bisect_left(hitos,l-x - 0.5) bisect.bisect_left(hitos,l-x - 0.5) lind queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)] [[int(x) for x in sys.stdin.readline().split()] for i in range(N)] queries
import bisect
import heapq
import sys
N,Q = [int(x) for x in sys.stdin.readline().split()]

hitos = []
ans = [-1 for _ in range(Q)]
queries =[]
jump = ans[::]



queries = [[int(x) for x in sys.stdin.readline().split()] for i in range(N)]
hitos = [int(sys.stdin.readline()) for i in range(Q)]


# for i in range(N):
    # S,T,X =list(map(int,input().split(" ")))
    # lt = S -X -0.5
    # rt = T -X -0.5
    # queries.append([lt,rt,X]) #-1 → 挿入クエリ lが時間、-1がクエリの種類、Xが場所


queries.sort(key=lambda x:x[2])





for l,r,x in queries:
     lind  = bisect.bisect_left(hitos,l-x - 0.5)
     rind  = bisect.bisect_left(hitos,r -x - 0.5)
     while lind < rind:
         if ans[lind] == -1:
            ans[lind] = x
            jump[lind] = rind
            lind += 1
         else:

             lind = jump[lind]

for i  in ans:
    print(i)
