import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d


import heapq

n,q = readints()

X = []

block = []
free = []
for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x])

b,d = compress(X)
block = [(x[0],d[x[1]]) for x in block]
free = [(x[0],d[x[1]]) for x in free]
heapq.heapify(block)
heapq.heapify(free)

ans = []

stop = []
heapq.heapify(stop)
deleted = []
heapq.heapify(deleted)

for i in range(q):
    D = readint()
    while block:
        if block[0][0]<=D:
            a = heapq.heappop(block)
            heapq.heappush(stop,a[1])
        else:
            break
    while free:
        if free[0][0]<=D:
            a = heapq.heappop(free)
            heapq.heappush(deleted,a[1])
        else:
            break
    while deleted:
        if stop[0] == deleted[0]:
            heapq.heappop(stop)
            heapq.heappop(deleted)
        else:
            break
    if stop:
        ans.append(stop[0])
    else:
        ans.append(-1)

ans = [b[x-1] if x >=0 else -1 for x in ans]
printrows(ans) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def readstr():return readline().rstrip().decode() readstr def readstrs():return list(readline().decode().split()) readstrs def readint():return int(readline()) readint def readints():return list(map(int,readline().split())) readints def printrows(x):print('\n'.join(map(str,x))) printrows x x def printline(x):print(' '.join(map(str,x))) printline x x def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d compress b = sorted(set(a)) b sorted(set(a)) sorted set(a) set a x:i+1 for i,x in enumerate(b) for i,x in enumerate(b) i x enumerate(b) enumerate b for i,x in enumerate(b) x i+1 i 1 d = {x:i+1 for i,x in enumerate(b)} d {x:i+1 for i,x in enumerate(b)} return b,d return b,d b d a a import heapq heapq n,q = readints() n readints() readints q X = [] X [] block = [] block [] free = [] free [] for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x]) i range(n) range n s,t,x = readints() s readints() readints t x X.append(x) X.append X append x block.append([s-x,x]) block.append block append [s-x,x] s-x s x x free.append([t-x,x]) free.append free append [t-x,x] t-x t x x b,d = compress(X) b compress(X) compress X d (x[0],d[x[1]]) for x in block for x in block x block for x in block (x[0],d[x[1]]) x[0] x 0 d[x[1]] d x[1] x 1 block = [(x[0],d[x[1]]) for x in block] block [(x[0],d[x[1]]) for x in block] (x[0],d[x[1]]) for x in free for x in free x free for x in free (x[0],d[x[1]]) x[0] x 0 d[x[1]] d x[1] x 1 free = [(x[0],d[x[1]]) for x in free] free [(x[0],d[x[1]]) for x in free] heapq.heapify(block) heapq.heapify heapq heapify block heapq.heapify(free) heapq.heapify heapq heapify free ans = [] ans [] stop = [] stop [] heapq.heapify(stop) heapq.heapify heapq heapify stop deleted = [] deleted [] heapq.heapify(deleted) heapq.heapify heapq heapify deleted for i in range(q):
    D = readint()
    while block:
        if block[0][0]<=D:
            a = heapq.heappop(block)
            heapq.heappush(stop,a[1])
        else:
            break
    while free:
        if free[0][0]<=D:
            a = heapq.heappop(free)
            heapq.heappush(deleted,a[1])
        else:
            break
    while deleted:
        if stop[0] == deleted[0]:
            heapq.heappop(stop)
            heapq.heappop(deleted)
        else:
            break
    if stop:
        ans.append(stop[0])
    else:
        ans.append(-1) i range(q) range q D = readint() D readint() readint while block:
        if block[0][0]<=D:
            a = heapq.heappop(block)
            heapq.heappush(stop,a[1])
        else:
            break
     block if block[0][0]<=D:
            a = heapq.heappop(block)
            heapq.heappush(stop,a[1])
        else:
            break
     block[0][0]<=D block[0][0] [0] block 0 0 D a = heapq.heappop(block) a heapq.heappop(block) heapq.heappop heapq heappop block heapq.heappush(stop,a[1]) heapq.heappush heapq heappush stop a[1] a 1 break while free:
        if free[0][0]<=D:
            a = heapq.heappop(free)
            heapq.heappush(deleted,a[1])
        else:
            break
     free if free[0][0]<=D:
            a = heapq.heappop(free)
            heapq.heappush(deleted,a[1])
        else:
            break
     free[0][0]<=D free[0][0] [0] free 0 0 D a = heapq.heappop(free) a heapq.heappop(free) heapq.heappop heapq heappop free heapq.heappush(deleted,a[1]) heapq.heappush heapq heappush deleted a[1] a 1 break while deleted:
        if stop[0] == deleted[0]:
            heapq.heappop(stop)
            heapq.heappop(deleted)
        else:
            break
     deleted if stop[0] == deleted[0]:
            heapq.heappop(stop)
            heapq.heappop(deleted)
        else:
            break
     stop[0] == deleted[0] stop[0] stop 0 deleted[0] deleted 0 heapq.heappop(stop) heapq.heappop heapq heappop stop heapq.heappop(deleted) heapq.heappop heapq heappop deleted break if stop:
        ans.append(stop[0])
    else:
        ans.append(-1) stop ans.append(stop[0]) ans.append ans append stop[0] stop 0 ans.append(-1) ans.append ans append -1 b[x-1] if x >=0 else -1 for x in ans for x in ans x ans for x in ans b[x-1] if x >=0 else -1 x >=0 x 0 b[x-1] b x-1 x 1 -1 ans = [b[x-1] if x >=0 else -1 for x in ans] ans [b[x-1] if x >=0 else -1 for x in ans] printrows(ans) printrows ans s,t,x = readints() readints() s a = heapq.heappop(block) heapq.heappop(block) a t,x = readints() readints() t def readstrs():return list(readline().decode().split()) def readstrs():return list(readline().decode().split()) readstrs def readints():return list(map(int,readline().split())) def readints():return list(map(int,readline().split())) readints def printrows(x):print('\n'.join(map(str,x))) def printrows(x):print('\n'.join(map(str,x))) printrows free = [] [] free D = readint() readint() D readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline stop = [] [] stop a = heapq.heappop(free) heapq.heappop(free) a def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d compress def readstr():return readline().rstrip().decode() def readstr():return readline().rstrip().decode() readstr free = [(x[0],d[x[1]]) for x in free] [(x[0],d[x[1]]) for x in free] free ans = [b[x-1] if x >=0 else -1 for x in ans] [b[x-1] if x >=0 else -1 for x in ans] ans ans = [] [] ans def readint():return int(readline()) def readint():return int(readline()) readint d = compress(X) compress(X) d X = [] [] X block = [] [] block block = [(x[0],d[x[1]]) for x in block] [(x[0],d[x[1]]) for x in block] block deleted = [] [] deleted q = readints() readints() q def printline(x):print(' '.join(map(str,x))) def printline(x):print(' '.join(map(str,x))) printline b,d = compress(X) compress(X) b n,q = readints() readints() n x = readints() readints() x
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d


import heapq

n,q = readints()

X = []

block = []
free = []
for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x])

b,d = compress(X)
block = [(x[0],d[x[1]]) for x in block]
free = [(x[0],d[x[1]]) for x in free]
heapq.heapify(block)
heapq.heapify(free)

ans = []

stop = []
heapq.heapify(stop)
deleted = []
heapq.heapify(deleted)

for i in range(q):
    D = readint()
    while block:
        if block[0][0]<=D:
            a = heapq.heappop(block)
            heapq.heappush(stop,a[1])
        else:
            break
    while free:
        if free[0][0]<=D:
            a = heapq.heappop(free)
            heapq.heappush(deleted,a[1])
        else:
            break
    while deleted:
        if stop[0] == deleted[0]:
            heapq.heappop(stop)
            heapq.heappop(deleted)
        else:
            break
    if stop:
        ans.append(stop[0])
    else:
        ans.append(-1)

ans = [b[x-1] if x >=0 else -1 for x in ans]
printrows(ans)
