from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,q=map(int,readline().split())

stx=[[int(x) for x in readline().split()] for _ in range(n)]
event=[]
for s,t,x in stx:
    event.append((s-x,1,x))
    event.append((t-x,-1,x))

for i in range(q):
    event.append((int(readline()),2,i))
event.sort()

ans=[0]*q

stop=set()
hq=[]
for t,op,x in event:
    if op==1:
        heappush(hq,x)
        stop.add(x)
    elif op==-1:
        stop.remove(x)

    else:
        while hq and hq[0] not in stop:
            heappop(hq) 
        ans[x]=hq[0] if hq else -1
    
for x in ans:
    print(x) from heapq import heappush, heappop import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines n,q=map(int,readline().split()) n map(int,readline().split()) map int readline().split() ().split () readline split q [int(x) for x in readline().split()] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [int(x) for x in readline().split()] stx=[[int(x) for x in readline().split()] for _ in range(n)] stx [[int(x) for x in readline().split()] for _ in range(n)] event=[] event [] for s,t,x in stx:
    event.append((s-x,1,x))
    event.append((t-x,-1,x)) s t x stx event.append((s-x,1,x)) event.append event append (s-x,1,x) s-x s x 1 x event.append((t-x,-1,x)) event.append event append (t-x,-1,x) t-x t x -1 x for i in range(q):
    event.append((int(readline()),2,i)) i range(q) range q event.append((int(readline()),2,i)) event.append event append (int(readline()),2,i) int(readline()) int readline() readline 2 i event.sort() event.sort event sort ans=[0]*q ans [0]*q [0] 0 q stop=set() stop set() set hq=[] hq [] for t,op,x in event:
    if op==1:
        heappush(hq,x)
        stop.add(x)
    elif op==-1:
        stop.remove(x)

    else:
        while hq and hq[0] not in stop:
            heappop(hq) 
        ans[x]=hq[0] if hq else -1
     t op x event if op==1:
        heappush(hq,x)
        stop.add(x)
    elif op==-1:
        stop.remove(x)

    else:
        while hq and hq[0] not in stop:
            heappop(hq) 
        ans[x]=hq[0] if hq else -1
     op==1 op 1 heappush(hq,x) heappush hq x stop.add(x) stop.add stop add x elif op==-1:
        stop.remove(x)

     op==-1 op -1 stop.remove(x) stop.remove stop remove x while hq and hq[0] not in stop:
            heappop(hq) 
         hq and hq[0] not in stop hq hq[0] not in stop hq[0] hq 0 stop heappop(hq) heappop hq ans[x]=hq[0] if hq else -1 ans[x] ans x hq[0] if hq else -1 hq hq[0] hq 0 -1 for x in ans:
    print(x) x ans print(x) print x hq=[] [] hq read = sys.stdin.buffer.read sys.stdin.buffer.read read q=map(int,readline().split()) map(int,readline().split()) q ans=[0]*q [0]*q ans stop=set() set() stop event=[] [] event stx=[[int(x) for x in readline().split()] for _ in range(n)] [[int(x) for x in readline().split()] for _ in range(n)] stx readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines n,q=map(int,readline().split()) map(int,readline().split()) n
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n,q=map(int,readline().split())

stx=[[int(x) for x in readline().split()] for _ in range(n)]
event=[]
for s,t,x in stx:
    event.append((s-x,1,x))
    event.append((t-x,-1,x))

for i in range(q):
    event.append((int(readline()),2,i))
event.sort()

ans=[0]*q

stop=set()
hq=[]
for t,op,x in event:
    if op==1:
        heappush(hq,x)
        stop.add(x)
    elif op==-1:
        stop.remove(x)

    else:
        while hq and hq[0] not in stop:
            heappop(hq) 
        ans[x]=hq[0] if hq else -1
    
for x in ans:
    print(x)