from heapq import heappush, heappop

import sys, os

from __pypy__ import builders

readline = sys.stdin.readline

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

qs = [0]*N

for i in range(N):

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

    qs[i] = (s-x, t-x, x)

qs.sort()



b = builders.StringBuilder(Q*11)

que = []

D = [int(readline()) for i in range(Q)]

j = 0

for d in D:

    while j < N and qs[j][0] <= d:

        s, t, x = qs[j]

        heappush(que, (x, t))

        j += 1

    while que and que[0][1] <= d:

        heappop(que)

    if que:

        b.append("%d\n" % que[0][0])

    else:

        b.append("-1\n")

sys.stdout.write(b.build())
from heapq import heappush, heappop

import sys



readline = sys.stdin.readline

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

ans = [None]*Q

def solve(readline=readline):

    qs = [0]*(N+1)

    for i in range(N):

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

        qs[i] = (s-x, t-x, x)

    qs[N] = (10**10, 10**10, 0)

    qs.sort()



    que = []

    D = [int(readline()) for i in range(Q)]

    j = 0

    it = iter(qs).__next__

    s, t, x = it()

    v = w = N

    for d in D:

        while j < N and s <= d:

            heappush(que, (x, t))

            v, w = que[0]

            s, t, x = it()

        while que and w <= d:

            heappop(que)

            if que:

                v, w = que[0]

        if que:

            yield "%d\n" % v

        else:

            yield "-1\n"

ans[:] = solve()

sys.stdout.writelines(ans)
from heapq import heappush, heappop
import sys, os
from __pypy__ import builders

readline = sys.stdin.readline
N, Q = list(map(int, readline().split()))
qs = [0] * N
for i in range(N):
    s, t, x = list(map(int, readline().split()))
    qs[i] = (s - x, t - x, x)
qs.sort()
b = builders.StringBuilder(Q * 11)
que = []
D = [int(readline()) for i in range(Q)]
j = 0
for d in D:
    while j < N and qs[j][0] <= d:
        s, t, x = qs[j]
        heappush(que, (x, t))
        j += 1
    while que and que[0][1] <= d:
        heappop(que)
    if que:
        b.append("%d\n" % que[0][0])
    else:
        b.append("-1\n")
sys.stdout.write(b.build())

from heapq import heappush, heappop
import sys

readline = sys.stdin.readline
N, Q = list(map(int, readline().split()))
ans = [None] * Q


def solve(readline=readline):
    qs = [0] * (N + 1)
    for i in range(N):
        s, t, x = list(map(int, readline().split()))
        qs[i] = (s - x, t - x, x)
    qs[N] = (10**10, 10**10, 0)
    qs.sort()
    que = []
    D = [int(readline()) for i in range(Q)]
    j = 0
    it = iter(qs).__next__
    s, t, x = it()
    v = w = N
    for d in D:
        while j < N and s <= d:
            heappush(que, (x, t))
            v, w = que[0]
            s, t, x = it()
        while que and w <= d:
            heappop(que)
            if que:
                v, w = que[0]
        if que:
            yield "%d\n" % v
        else:
            yield "-1\n"


ans[:] = solve()
sys.stdout.writelines(ans)

-import sys, os -from __pypy__ import builders +import sys -qs = [0] * N -for i in range(N): -    s, t, x = list(map(int, readline().split())) -    qs[i] = (s - x, t - x, x) -qs.sort() -b = builders.StringBuilder(Q * 11) -que = [] -D = [int(readline()) for i in range(Q)] -j = 0 -for d in D: -    while j < N and qs[j][0] <= d: -        s, t, x = qs[j] -        heappush(que, (x, t)) -        j += 1 -    while que and que[0][1] <= d: -        heappop(que) -    if que: -        b.append("%d\n" % que[0][0]) -    else: -        b.append("-1\n") -sys.stdout.write(b.build()) +ans = [None] * Q + + +def solve(readline=readline): +    qs = [0] * (N + 1) +    for i in range(N): +        s, t, x = list(map(int, readline().split())) +        qs[i] = (s - x, t - x, x) +    qs[N] = (10**10, 10**10, 0) +    qs.sort() +    que = [] +    D = [int(readline()) for i in range(Q)] +    j = 0 +    it = iter(qs).__next__ +    s, t, x = it() +    v = w = N +    for d in D: +        while j < N and s <= d: +            heappush(que, (x, t)) +            v, w = que[0] +            s, t, x = it() +        while que and w <= d: +            heappop(que) +            if que: +                v, w = que[0] +        if que: +            yield "%d\n" % v +        else: +            yield "-1\n" + + +ans[:] = solve() +sys.stdout.writelines(ans)