from heapq import heappush, heappop


n, q = map(int, input().split())
events = []

for i in range(n):
    s, t, x = map(int, input().split())
    if t >= x:
        events.append([t - x, 0, x])
        events.append([s - x, 1, x])
for i in range(q):
    d = int(input())
    events.append([d, 2, i])
events.sort()

dist = [-1] * q
walker = []
working = set()
heap = []
for t, kind, x in events:
    if kind == 0:
        working.remove(x)
    elif kind == 1:
        working.add(x)
        heappush(heap, x)
    elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0]

print(*dist, sep="\n") from heapq import heappush, heappop n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q events = [] events [] for i in range(n):
    s, t, x = map(int, input().split())
    if t >= x:
        events.append([t - x, 0, x])
        events.append([s - x, 1, x]) i range(n) range n s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x if t >= x:
        events.append([t - x, 0, x])
        events.append([s - x, 1, x]) t >= x t x events.append([t - x, 0, x]) events.append events append [t - x, 0, x] t - x t x 0 x events.append([s - x, 1, x]) events.append events append [s - x, 1, x] s - x s x 1 x for i in range(q):
    d = int(input())
    events.append([d, 2, i]) i range(q) range q d = int(input()) d int(input()) int input() input events.append([d, 2, i]) events.append events append [d, 2, i] d 2 i events.sort() events.sort events sort dist = [-1] * q dist [-1] * q [-1] -1 q walker = [] walker [] working = set() working set() set heap = [] heap [] for t, kind, x in events:
    if kind == 0:
        working.remove(x)
    elif kind == 1:
        working.add(x)
        heappush(heap, x)
    elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0] t kind x events if kind == 0:
        working.remove(x)
    elif kind == 1:
        working.add(x)
        heappush(heap, x)
    elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0] kind == 0 kind 0 working.remove(x) working.remove working remove x elif kind == 1:
        working.add(x)
        heappush(heap, x)
     kind == 1 kind 1 working.add(x) working.add working add x heappush(heap, x) heappush heap x elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0] working while not heap[0] in working:
            heappop(heap)
         not heap[0] in working heap[0] in working heap[0] heap 0 working heappop(heap) heappop heap dist[x] = heap[0] dist[x] dist x heap[0] heap 0 print(*dist, sep="\n") print *dist dist sep="\n" sep "\n" q = map(int, input().split()) map(int, input().split()) q dist = [-1] * q [-1] * q dist t, x = map(int, input().split()) map(int, input().split()) t d = int(input()) int(input()) d heap = [] [] heap s, t, x = map(int, input().split()) map(int, input().split()) s x = map(int, input().split()) map(int, input().split()) x walker = [] [] walker n, q = map(int, input().split()) map(int, input().split()) n working = set() set() working events = [] [] events
from heapq import heappush, heappop


n, q = map(int, input().split())
events = []

for i in range(n):
    s, t, x = map(int, input().split())
    if t >= x:
        events.append([t - x, 0, x])
        events.append([s - x, 1, x])
for i in range(q):
    d = int(input())
    events.append([d, 2, i])
events.sort()

dist = [-1] * q
walker = []
working = set()
heap = []
for t, kind, x in events:
    if kind == 0:
        working.remove(x)
    elif kind == 1:
        working.add(x)
        heappush(heap, x)
    elif working:
        while not heap[0] in working:
            heappop(heap)
        dist[x] = heap[0]

print(*dist, sep="\n")