import sys
input = lambda : sys.stdin.readline().rstrip()

from heapq import heappush, heappop 

running = []
events = []
delete = set()

n, q = map(int, input().split())
for _ in range(n):
    s, t, x = map(int, input().split())
    time = max(s - x, 0)
    if t - x < 0:
        continue
    events.append((s - x, x, 1)) # 追加イベント
    events.append((t - x, x, 0)) # 削除イベント
events.sort()
ans = []
idx = -1
for _ in range(q):
    d = int(input())
    if d >= events[-1][0]:
        print(-1)
        #ans.append(-1)
        continue
    while events[idx + 1][0] <= d:
        idx += 1
        if events[idx][2] == 1:
            heappush(running, events[idx][1])
            delete.discard(events[idx][1])
        else:
            delete.add(events[idx][1])
    flag = 1
    while running:
        x = heappop(running)
        if x not in delete:
            heappush(running, x)
            print(x)
            #ans.append(x)
            flag = 0
            break
    if flag:
        print(-1) import sys sys input = lambda : sys.stdin.readline().rstrip() input lambda : sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip from heapq import heappush, heappop running = [] running [] events = [] events [] delete = set() delete set() set n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q for _ in range(n):
    s, t, x = map(int, input().split())
    time = max(s - x, 0)
    if t - x < 0:
        continue
    events.append((s - x, x, 1)) # 追加イベント
    events.append((t - x, x, 0)) # 削除イベント _ 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 time = max(s - x, 0) time max(s - x, 0) max s - x s x 0 if t - x < 0:
        continue
     t - x < 0 t - x t x 0 continue events.append((s - x, x, 1)) events.append events append (s - x, x, 1) s - x s x x 1 events.append((t - x, x, 0)) events.append events append (t - x, x, 0) t - x t x x 0 events.sort() events.sort events sort ans = [] ans [] idx = -1 idx -1 for _ in range(q):
    d = int(input())
    if d >= events[-1][0]:
        print(-1)
        #ans.append(-1)
        continue
    while events[idx + 1][0] <= d:
        idx += 1
        if events[idx][2] == 1:
            heappush(running, events[idx][1])
            delete.discard(events[idx][1])
        else:
            delete.add(events[idx][1])
    flag = 1
    while running:
        x = heappop(running)
        if x not in delete:
            heappush(running, x)
            print(x)
            #ans.append(x)
            flag = 0
            break
    if flag:
        print(-1) _ range(q) range q d = int(input()) d int(input()) int input() input if d >= events[-1][0]:
        print(-1)
        #ans.append(-1)
        continue
     d >= events[-1][0] d events[-1][0] [-1] events -1 0 print(-1) print -1 continue while events[idx + 1][0] <= d:
        idx += 1
        if events[idx][2] == 1:
            heappush(running, events[idx][1])
            delete.discard(events[idx][1])
        else:
            delete.add(events[idx][1])
     events[idx + 1][0] <= d events[idx + 1][0] [idx + 1] events idx + 1 idx 1 0 d idx += 1 idx 1 if events[idx][2] == 1:
            heappush(running, events[idx][1])
            delete.discard(events[idx][1])
        else:
            delete.add(events[idx][1])
     events[idx][2] == 1 events[idx][2] [idx] events idx 2 1 heappush(running, events[idx][1]) heappush running events[idx][1] [idx] events idx 1 delete.discard(events[idx][1]) delete.discard delete discard events[idx][1] [idx] events idx 1 delete.add(events[idx][1]) delete.add delete add events[idx][1] [idx] events idx 1 flag = 1 flag 1 while running:
        x = heappop(running)
        if x not in delete:
            heappush(running, x)
            print(x)
            #ans.append(x)
            flag = 0
            break
     running x = heappop(running) x heappop(running) heappop running if x not in delete:
            heappush(running, x)
            print(x)
            #ans.append(x)
            flag = 0
            break
     x not in delete x delete heappush(running, x) heappush running x print(x) print x flag = 0 flag 0 break if flag:
        print(-1) flag print(-1) print -1 t, x = map(int, input().split()) map(int, input().split()) t x = map(int, input().split()) map(int, input().split()) x delete = set() set() delete idx += 1 1 idx q = map(int, input().split()) map(int, input().split()) q d = int(input()) int(input()) d ans = [] [] ans events = [] [] events time = max(s - x, 0) max(s - x, 0) time flag = 0 0 flag idx = -1 -1 idx running = [] [] running s, t, x = map(int, input().split()) map(int, input().split()) s x = heappop(running) heappop(running) x n, q = map(int, input().split()) map(int, input().split()) n input = lambda : sys.stdin.readline().rstrip() lambda : sys.stdin.readline().rstrip() input flag = 1 1 flag
import sys
input = lambda : sys.stdin.readline().rstrip()

from heapq import heappush, heappop 

running = []
events = []
delete = set()

n, q = map(int, input().split())
for _ in range(n):
    s, t, x = map(int, input().split())
    time = max(s - x, 0)
    if t - x < 0:
        continue
    events.append((s - x, x, 1)) # 追加イベント
    events.append((t - x, x, 0)) # 削除イベント
events.sort()
ans = []
idx = -1
for _ in range(q):
    d = int(input())
    if d >= events[-1][0]:
        print(-1)
        #ans.append(-1)
        continue
    while events[idx + 1][0] <= d:
        idx += 1
        if events[idx][2] == 1:
            heappush(running, events[idx][1])
            delete.discard(events[idx][1])
        else:
            delete.add(events[idx][1])
    flag = 1
    while running:
        x = heappop(running)
        if x not in delete:
            heappush(running, x)
            print(x)
            #ans.append(x)
            flag = 0
            break
    if flag:
        print(-1)