import sys

from heapq import heappop, heappush



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

lines = sys.stdin.readlines()

events = []

kkk = []

for line in lines[:n]:

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

    events.append((s - x, 2, x))

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

for line in lines[n:]:

    events.append((int(line), 3))

events.sort()



constructing = []

available = set()

buf = []

for ev in events:

    if ev[1] == 2:

        heappush(constructing, ev[2])

        available.add(ev[2])

    elif ev[1] == 1:

        available.remove(ev[2])

    else:

        if not available:

            buf.append(-1)

        else:

            while constructing[0] not in available:

                heappop(constructing)

            buf.append(constructing[0])

print(('\n'.join(map(str, buf))))

import sys

from bisect import bisect_left



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

lines = sys.stdin.readlines()

kkk = []

for line in lines[:n]:

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

    kkk.append((x, s, t))

kkk.sort()

ddd = list(map(int, lines[n:]))



ans = [-1] * q

skip = [-1] * q

for x, s, t in kkk:

    ss = bisect_left(ddd, s - x)

    tt = bisect_left(ddd, t - x)

    while ss < tt:

        sk = skip[ss]

        if sk == -1:

            ans[ss] = x

            skip[ss] = tt

            ss += 1

        else:

            skip[ss] = max(sk, tt)

            ss = sk

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

import sys
from heapq import heappop, heappush

n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
events = []
kkk = []
for line in lines[:n]:
    s, t, x = list(map(int, line.split()))
    events.append((s - x, 2, x))
    events.append((t - x, 1, x))
for line in lines[n:]:
    events.append((int(line), 3))
events.sort()
constructing = []
available = set()
buf = []
for ev in events:
    if ev[1] == 2:
        heappush(constructing, ev[2])
        available.add(ev[2])
    elif ev[1] == 1:
        available.remove(ev[2])
    else:
        if not available:
            buf.append(-1)
        else:
            while constructing[0] not in available:
                heappop(constructing)
            buf.append(constructing[0])
print(("\n".join(map(str, buf))))

import sys
from bisect import bisect_left

n, q = list(map(int, input().split()))
lines = sys.stdin.readlines()
kkk = []
for line in lines[:n]:
    s, t, x = list(map(int, line.split()))
    kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[n:]))
ans = [-1] * q
skip = [-1] * q
for x, s, t in kkk:
    ss = bisect_left(ddd, s - x)
    tt = bisect_left(ddd, t - x)
    while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            skip[ss] = max(sk, tt)
            ss = sk
print(("\n".join(map(str, ans))))

-from heapq import heappop, heappush +from bisect import bisect_left -events = [] -    events.append((s - x, 2, x)) -    events.append((t - x, 1, x)) -for line in lines[n:]: -    events.append((int(line), 3)) -events.sort() -constructing = [] -available = set() -buf = [] -for ev in events: -    if ev[1] == 2: -        heappush(constructing, ev[2]) -        available.add(ev[2]) -    elif ev[1] == 1: -        available.remove(ev[2]) -    else: -        if not available: -            buf.append(-1) +    kkk.append((x, s, t)) +kkk.sort() +ddd = list(map(int, lines[n:])) +ans = [-1] * q +skip = [-1] * q +for x, s, t in kkk: +    ss = bisect_left(ddd, s - x) +    tt = bisect_left(ddd, t - x) +    while ss < tt: +        sk = skip[ss] +        if sk == -1: +            ans[ss] = x +            skip[ss] = tt +            ss += 1 -            while constructing[0] not in available: -                heappop(constructing) -            buf.append(constructing[0]) -print(("\n".join(map(str, buf)))) +            skip[ss] = max(sk, tt) +            ss = sk +print(("\n".join(map(str, ans))))