def main():

    from heapq import heappush, heappop

    import sys

    sys.setrecursionlimit(10 ** 7)



    n,q=list(map(int,input().split()))



    event=[]

    for _ in range(n):

        s,t,x=list(map(int,input().split()))

        event.append((s-x,1,x))

        event.append((t-x,-1,x))



    for i in range(q):

        event.append((int(eval(input())),2,i))

    event.sort()



    ans=[0]*q



    stop=set()

    hq=[]

    for t,op,x in event:

        if op==1:

            heappush(hq,x)

            stop.add(x)

        elif op==-1:

            stop.remove(x)



        else:

            while hq and hq[0] not in stop:

                heappop(hq) 

            ans[x]=hq[0] if hq else -1

        

    for x in ans:

        print(x)



main()
from heapq import heappush, heappop

import sys

sys.setrecursionlimit(10 ** 7)



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



N, Q = list(map(int, readline().split()))

STX = [[int(x) for x in readline().split()] for _ in range(N)]

EVENT = []

for s, t, x in STX:

    EVENT.append((s-x, 1, x))

    EVENT.append((t-x, 0, x))



for i in range(Q):

    d = int(readline())

    EVENT.append((d, 2, i))



ans = [-1] * Q



EVENT.sort()





STOP = set()

h = []

for t, op, x in EVENT:

    if op == 2 and STOP:

        while h and h[0] not in STOP:

            heappop(h)

        ans[x] = h[0]

    elif op == 1:

        STOP.add(x)

        heappush(h, x)

    elif op == 0:

        STOP.remove(x)



print(("\n".join(map(str, ans))))

def main():
    from heapq import heappush, heappop
    import sys

    sys.setrecursionlimit(10**7)
    n, q = list(map(int, input().split()))
    event = []
    for _ in range(n):
        s, t, x = list(map(int, input().split()))
        event.append((s - x, 1, x))
        event.append((t - x, -1, x))
    for i in range(q):
        event.append((int(eval(input())), 2, i))
    event.sort()
    ans = [0] * q
    stop = set()
    hq = []
    for t, op, x in event:
        if op == 1:
            heappush(hq, x)
            stop.add(x)
        elif op == -1:
            stop.remove(x)
        else:
            while hq and hq[0] not in stop:
                heappop(hq)
            ans[x] = hq[0] if hq else -1
    for x in ans:
        print(x)


main()

from heapq import heappush, heappop
import sys

sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, Q = list(map(int, readline().split()))
STX = [[int(x) for x in readline().split()] for _ in range(N)]
EVENT = []
for s, t, x in STX:
    EVENT.append((s - x, 1, x))
    EVENT.append((t - x, 0, x))
for i in range(Q):
    d = int(readline())
    EVENT.append((d, 2, i))
ans = [-1] * Q
EVENT.sort()
STOP = set()
h = []
for t, op, x in EVENT:
    if op == 2 and STOP:
        while h and h[0] not in STOP:
            heappop(h)
        ans[x] = h[0]
    elif op == 1:
        STOP.add(x)
        heappush(h, x)
    elif op == 0:
        STOP.remove(x)
print(("\n".join(map(str, ans))))

-def main(): -    from heapq import heappush, heappop -    import sys +from heapq import heappush, heappop +import sys -    sys.setrecursionlimit(10**7) -    n, q = list(map(int, input().split())) -    event = [] -    for _ in range(n): -        s, t, x = list(map(int, input().split())) -        event.append((s - x, 1, x)) -        event.append((t - x, -1, x)) -    for i in range(q): -        event.append((int(eval(input())), 2, i)) -    event.sort() -    ans = [0] * q -    stop = set() -    hq = [] -    for t, op, x in event: -        if op == 1: -            heappush(hq, x) -            stop.add(x) -        elif op == -1: -            stop.remove(x) -        else: -            while hq and hq[0] not in stop: -                heappop(hq) -            ans[x] = hq[0] if hq else -1 -    for x in ans: -        print(x) - - -main() +sys.setrecursionlimit(10**7) +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines +N, Q = list(map(int, readline().split())) +STX = [[int(x) for x in readline().split()] for _ in range(N)] +EVENT = [] +for s, t, x in STX: +    EVENT.append((s - x, 1, x)) +    EVENT.append((t - x, 0, x)) +for i in range(Q): +    d = int(readline()) +    EVENT.append((d, 2, i)) +ans = [-1] * Q +EVENT.sort() +STOP = set() +h = [] +for t, op, x in EVENT: +    if op == 2 and STOP: +        while h and h[0] not in STOP: +            heappop(h) +        ans[x] = h[0] +    elif op == 1: +        STOP.add(x) +        heappush(h, x) +    elif op == 0: +        STOP.remove(x) +print(("\n".join(map(str, ans))))