import sys
import heapq
from collections import defaultdict
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, Q = map(int, input().split())
task = []
for _ in range(N):
    s, t, x = map(int, input().split())
    start = t - x
    end = s - x
    task.append((start, -1, x))
    task.append((end, 1, x))
task.sort(reverse=True)

cand = []
discard = defaultdict(int)
ans = []

for _ in range(Q):
    d = int(input())
    while task and task[-1][0] <= d:
        _, flag, x = task.pop()
        if flag == 1:
            heapq.heappush(cand, x)
        else:
            discard[x] += 1

    while cand:
        x = cand[0]
        if discard[x] > 0:
            heapq.heappop(cand)
            discard[x] -= 1
        else:
            break

    if cand:
        ans.append(cand[0])
    else:
        ans.append(-1)

print(*ans, sep="\n") import sys sys import heapq heapq from collections import defaultdict input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q task = [] task [] for _ in range(N):
    s, t, x = map(int, input().split())
    start = t - x
    end = s - x
    task.append((start, -1, x))
    task.append((end, 1, x)) _ 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 start = t - x start t - x t x end = s - x end s - x s x task.append((start, -1, x)) task.append task append (start, -1, x) start -1 x task.append((end, 1, x)) task.append task append (end, 1, x) end 1 x task.sort(reverse=True) task.sort task sort reverse=True reverse True cand = [] cand [] discard = defaultdict(int) discard defaultdict(int) defaultdict int ans = [] ans [] for _ in range(Q):
    d = int(input())
    while task and task[-1][0] <= d:
        _, flag, x = task.pop()
        if flag == 1:
            heapq.heappush(cand, x)
        else:
            discard[x] += 1

    while cand:
        x = cand[0]
        if discard[x] > 0:
            heapq.heappop(cand)
            discard[x] -= 1
        else:
            break

    if cand:
        ans.append(cand[0])
    else:
        ans.append(-1) _ range(Q) range Q d = int(input()) d int(input()) int input() input while task and task[-1][0] <= d:
        _, flag, x = task.pop()
        if flag == 1:
            heapq.heappush(cand, x)
        else:
            discard[x] += 1

     task and task[-1][0] <= d task task[-1][0] <= d task[-1][0] [-1] task -1 0 d _, flag, x = task.pop() _ task.pop() task.pop task pop flag x if flag == 1:
            heapq.heappush(cand, x)
        else:
            discard[x] += 1

     flag == 1 flag 1 heapq.heappush(cand, x) heapq.heappush heapq heappush cand x discard[x] += 1 discard[x] discard x 1 while cand:
        x = cand[0]
        if discard[x] > 0:
            heapq.heappop(cand)
            discard[x] -= 1
        else:
            break

     cand x = cand[0] x cand[0] cand 0 if discard[x] > 0:
            heapq.heappop(cand)
            discard[x] -= 1
        else:
            break

     discard[x] > 0 discard[x] discard x 0 heapq.heappop(cand) heapq.heappop heapq heappop cand discard[x] -= 1 discard[x] discard x 1 break if cand:
        ans.append(cand[0])
    else:
        ans.append(-1) cand ans.append(cand[0]) ans.append ans append cand[0] cand 0 ans.append(-1) ans.append ans append -1 print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" N, Q = map(int, input().split()) map(int, input().split()) N cand = [] [] cand flag, x = task.pop() task.pop() flag task = [] [] task start = t - x t - x start Q = map(int, input().split()) map(int, input().split()) Q x = map(int, input().split()) map(int, input().split()) x t, x = map(int, input().split()) map(int, input().split()) t end = s - x s - x end ans = [] [] ans _, flag, x = task.pop() task.pop() _ x = cand[0] cand[0] x s, t, x = map(int, input().split()) map(int, input().split()) s input = sys.stdin.buffer.readline sys.stdin.buffer.readline input d = int(input()) int(input()) d x = task.pop() task.pop() x discard = defaultdict(int) defaultdict(int) discard
import sys
import heapq
from collections import defaultdict
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, Q = map(int, input().split())
task = []
for _ in range(N):
    s, t, x = map(int, input().split())
    start = t - x
    end = s - x
    task.append((start, -1, x))
    task.append((end, 1, x))
task.sort(reverse=True)

cand = []
discard = defaultdict(int)
ans = []

for _ in range(Q):
    d = int(input())
    while task and task[-1][0] <= d:
        _, flag, x = task.pop()
        if flag == 1:
            heapq.heappush(cand, x)
        else:
            discard[x] += 1

    while cand:
        x = cand[0]
        if discard[x] > 0:
            heapq.heappop(cand)
            discard[x] -= 1
        else:
            break

    if cand:
        ans.append(cand[0])
    else:
        ans.append(-1)

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