from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18

N, Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

ST = []
for s, t, x in STX:
    ST.append([s - x, t - x])

start = [[] for _ in range(Q + 1)]
end   = [[] for _ in range(Q + 1)]

for i, (s, t) in enumerate(ST):
    si = bisect_left(D, s)
    ti = bisect_left(D, t)
    start[si].append(STX[i][2])
    end[ti].append(STX[i][2])
#print(start)
#print(end)

end_flag = defaultdict(int)
hp = []

for i in range(Q):
    for ed in end[i]:
        end_flag[ed] += 1
    for st in start[i]:
        heappush(hp, st)
    #print(i, hp)
    while 1:
        if hp:
            tmp = heappop(hp)
            if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
        else:
            print(-1)
            break from sys import stdin, setrecursionlimit input = stdin.buffer.readline input stdin.buffer.readline stdin.buffer stdin buffer readline setrecursionlimit(10 ** 7) setrecursionlimit 10 ** 7 10 7 from heapq import heappush, heappop from bisect import bisect_left, bisect_right from collections import deque, defaultdict from itertools import combinations, permutations, combinations_with_replacement from itertools import accumulate from math import ceil, sqrt, pi MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = 10 ** 18 INF 10 ** 18 10 18 N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q list(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split STX = [list(map(int, input().split())) for _ in range(N)] STX [list(map(int, input().split())) for _ in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] ST = [] ST [] for s, t, x in STX:
    ST.append([s - x, t - x]) s t x STX ST.append([s - x, t - x]) ST.append ST append [s - x, t - x] s - x s x t - x t x [] for _ in range(Q + 1) for _ in range(Q + 1) _ range(Q + 1) range Q + 1 Q 1 for _ in range(Q + 1) [] start = [[] for _ in range(Q + 1)] start [[] for _ in range(Q + 1)] [] for _ in range(Q + 1) for _ in range(Q + 1) _ range(Q + 1) range Q + 1 Q 1 for _ in range(Q + 1) [] end   = [[] for _ in range(Q + 1)] end [[] for _ in range(Q + 1)] for i, (s, t) in enumerate(ST):
    si = bisect_left(D, s)
    ti = bisect_left(D, t)
    start[si].append(STX[i][2])
    end[ti].append(STX[i][2])
#print(start)
#print(end) i (s, t) s t enumerate(ST) enumerate ST si = bisect_left(D, s) si bisect_left(D, s) bisect_left D s ti = bisect_left(D, t) ti bisect_left(D, t) bisect_left D t start[si].append(STX[i][2]) [si].append [si] start si append STX[i][2] [i] STX i 2 end[ti].append(STX[i][2]) [ti].append [ti] end ti append STX[i][2] [i] STX i 2 end_flag = defaultdict(int) end_flag defaultdict(int) defaultdict int hp = [] hp [] for i in range(Q):
    for ed in end[i]:
        end_flag[ed] += 1
    for st in start[i]:
        heappush(hp, st)
    #print(i, hp)
    while 1:
        if hp:
            tmp = heappop(hp)
            if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
        else:
            print(-1)
            break i range(Q) range Q for ed in end[i]:
        end_flag[ed] += 1
     ed end[i] end i end_flag[ed] += 1 end_flag[ed] end_flag ed 1 for st in start[i]:
        heappush(hp, st)
    #print(i, hp)
     st start[i] start i heappush(hp, st) heappush hp st while 1:
        if hp:
            tmp = heappop(hp)
            if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
        else:
            print(-1)
            break 1 if hp:
            tmp = heappop(hp)
            if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
        else:
            print(-1)
            break hp tmp = heappop(hp) tmp heappop(hp) heappop hp if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
         end_flag[tmp] end_flag tmp end_flag[tmp] -= 1 end_flag[tmp] end_flag tmp 1 print(tmp) print tmp heappush(hp, tmp) heappush hp tmp break print(-1) print -1 break D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D STX = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] STX INF = 10 ** 18 10 ** 18 INF end_flag = defaultdict(int) defaultdict(int) end_flag input = stdin.buffer.readline stdin.buffer.readline input Q = map(int, input().split()) map(int, input().split()) Q ti = bisect_left(D, t) bisect_left(D, t) ti ST = [] [] ST start = [[] for _ in range(Q + 1)] [[] for _ in range(Q + 1)] start tmp = heappop(hp) heappop(hp) tmp MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD hp = [] [] hp N, Q = map(int, input().split()) map(int, input().split()) N si = bisect_left(D, s) bisect_left(D, s) si end   = [[] for _ in range(Q + 1)] [[] for _ in range(Q + 1)] end
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18

N, Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

ST = []
for s, t, x in STX:
    ST.append([s - x, t - x])

start = [[] for _ in range(Q + 1)]
end   = [[] for _ in range(Q + 1)]

for i, (s, t) in enumerate(ST):
    si = bisect_left(D, s)
    ti = bisect_left(D, t)
    start[si].append(STX[i][2])
    end[ti].append(STX[i][2])
#print(start)
#print(end)

end_flag = defaultdict(int)
hp = []

for i in range(Q):
    for ed in end[i]:
        end_flag[ed] += 1
    for st in start[i]:
        heappush(hp, st)
    #print(i, hp)
    while 1:
        if hp:
            tmp = heappop(hp)
            if end_flag[tmp]:
                end_flag[tmp] -= 1
            else:
                print(tmp)
                heappush(hp, tmp)
                break
        else:
            print(-1)
            break