import sys

from heapq import heappush, heappop





I = sys.stdin.readlines()

N, Q = list(map(int, I[0].split()))

P = []

for i in range(1, N + 1):

    s, t, x = list(map(int, I[i].split()))

    P.append((s - x, t - 1 - x, x))

P.sort()

INF = float('inf')

P.append((INF, INF, INF))



q = []

cur = 0

s, t, x = P[cur]

for i in range(N + 1, N + Q + 1):

    d = int(I[i])

    while s <= d:

        heappush(q, (x, t))

        cur += 1

        s, t, x = P[cur]

    ans = -1

    while len(q) > 0:

        x1, t1 = q[0]

        if d <= t1:

            ans = x1

            break

        else:

            heappop(q)

    print(ans)



import sys

from heapq import heappush, heappop





N, Q = map(int, input().split())

P = []

for i in range(1, N + 1):

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

    P.append((s - x, t - 1 - x, x))

P.sort()





q = []

cur = 0

ans = [-1] * Q

for i, d in enumerate(map(int, sys.stdin)):

    while cur < N and P[cur][0] <= d:

        s, t, x = P[cur]

        heappush(q, (x, t))

        cur += 1

    while q:

        x, t = q[0]

        if d <= t:

            ans[i] = x

            break

        else:

            heappop(q)



print(*ans, sep='\n')

import sys
from heapq import heappush, heappop

I = sys.stdin.readlines()
N, Q = list(map(int, I[0].split()))
P = []
for i in range(1, N + 1):
    s, t, x = list(map(int, I[i].split()))
    P.append((s - x, t - 1 - x, x))
P.sort()
INF = float("inf")
P.append((INF, INF, INF))
q = []
cur = 0
s, t, x = P[cur]
for i in range(N + 1, N + Q + 1):
    d = int(I[i])
    while s <= d:
        heappush(q, (x, t))
        cur += 1
        s, t, x = P[cur]
    ans = -1
    while len(q) > 0:
        x1, t1 = q[0]
        if d <= t1:
            ans = x1
            break
        else:
            heappop(q)
    print(ans)

import sys
from heapq import heappush, heappop

N, Q = map(int, input().split())
P = []
for i in range(1, N + 1):
    s, t, x = map(int, sys.stdin.readline().split())
    P.append((s - x, t - 1 - x, x))
P.sort()
q = []
cur = 0
ans = [-1] * Q
for i, d in enumerate(map(int, sys.stdin)):
    while cur < N and P[cur][0] <= d:
        s, t, x = P[cur]
        heappush(q, (x, t))
        cur += 1
    while q:
        x, t = q[0]
        if d <= t:
            ans[i] = x
            break
        else:
            heappop(q)
print(*ans, sep="\n")

-I = sys.stdin.readlines() -N, Q = list(map(int, I[0].split())) +N, Q = map(int, input().split()) -    s, t, x = list(map(int, I[i].split())) +    s, t, x = map(int, sys.stdin.readline().split()) -INF = float("inf") -P.append((INF, INF, INF)) -s, t, x = P[cur] -for i in range(N + 1, N + Q + 1): -    d = int(I[i]) -    while s <= d: +ans = [-1] * Q +for i, d in enumerate(map(int, sys.stdin)): +    while cur < N and P[cur][0] <= d: +        s, t, x = P[cur] -        s, t, x = P[cur] -    ans = -1 -    while len(q) > 0: -        x1, t1 = q[0] -        if d <= t1: -            ans = x1 +    while q: +        x, t = q[0] +        if d <= t: +            ans[i] = x -    print(ans) +print(*ans, sep="\n")