# -*- coding: utf-8 -*-
import sys
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right

N,Q=map(int, sys.stdin.readline().split())

S=[]
event=[]	#x, s, t
for _ in range(N):
	s,t,x=map(int, sys.stdin.readline().split())
	heappush( event, (x, max(0,s-x) , max(0,t-1-x)) )


D=[ int(sys.stdin.readline().strip()) for _ in range(Q) ]
D.sort()
ans=[ float("inf") for _ in range(Q) ]

Next=[ i+1 for i in range(Q) ]	#Next


while event:
	x,s,t=heappop(event)
	start=bisect_left(D,s)
	end=bisect_right(D,t)

	i=start
	while i<end:
		ans[i]=min(ans[i],x)
		next=Next[i]
		Next[i]=end
		i=next

for x in ans:
	if x==float("inf"):
		print -1
	else:
		print x
 import sys sys from heapq import heappush, heappop from bisect import bisect_left, bisect_right N,Q=map(int, sys.stdin.readline().split()) N map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split Q S=[] S [] event=[] event [] for _ in range(N):
	s,t,x=map(int, sys.stdin.readline().split())
	heappush( event, (x, max(0,s-x) , max(0,t-1-x)) ) _ range(N) range N s,t,x=map(int, sys.stdin.readline().split()) s map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split t x heappush( event, (x, max(0,s-x) , max(0,t-1-x)) ) heappush event (x, max(0,s-x) , max(0,t-1-x)) x max(0,s-x) max 0 s-x s x max(0,t-1-x) max 0 t-1-x t-1 t 1 x int(sys.stdin.readline().strip()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(sys.stdin.readline().strip()) int sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip D=[ int(sys.stdin.readline().strip()) for _ in range(Q) ] D [ int(sys.stdin.readline().strip()) for _ in range(Q) ] D.sort() D.sort D sort float("inf") for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) float("inf") float "inf" ans=[ float("inf") for _ in range(Q) ] ans [ float("inf") for _ in range(Q) ] i+1 for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) i+1 i 1 Next=[ i+1 for i in range(Q) ] Next [ i+1 for i in range(Q) ] while event:
	x,s,t=heappop(event)
	start=bisect_left(D,s)
	end=bisect_right(D,t)

	i=start
	while i<end:
		ans[i]=min(ans[i],x)
		next=Next[i]
		Next[i]=end
		i=next event x,s,t=heappop(event) x heappop(event) heappop event s t start=bisect_left(D,s) start bisect_left(D,s) bisect_left D s end=bisect_right(D,t) end bisect_right(D,t) bisect_right D t i=start i start while i<end:
		ans[i]=min(ans[i],x)
		next=Next[i]
		Next[i]=end
		i=next i<end i end ans[i]=min(ans[i],x) ans[i] ans i min(ans[i],x) min ans[i] ans i x next=Next[i] next Next[i] Next i Next[i]=end Next[i] Next i end i=next i next for x in ans:
	if x==float("inf"):
		print -1
	else:
		print x x ans if x==float("inf"):
		print -1
	else:
		print x x==float("inf") x float("inf") float "inf" print -1 print 1 print N,Q=map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) N t,x=map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) t x,s,t=heappop(event) heappop(event) x end=bisect_right(D,t) bisect_right(D,t) end i=start start i start=bisect_left(D,s) bisect_left(D,s) start next=Next[i] Next[i] next t=heappop(event) heappop(event) t Next=[ i+1 for i in range(Q) ] [ i+1 for i in range(Q) ] Next Q=map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) Q S=[] [] S event=[] [] event s,t=heappop(event) heappop(event) s s,t,x=map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) s D=[ int(sys.stdin.readline().strip()) for _ in range(Q) ] [ int(sys.stdin.readline().strip()) for _ in range(Q) ] D ans=[ float("inf") for _ in range(Q) ] [ float("inf") for _ in range(Q) ] ans x=map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) x i=next next i
# -*- coding: utf-8 -*-
import sys
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right

N,Q=map(int, sys.stdin.readline().split())

S=[]
event=[]	#x, s, t
for _ in range(N):
	s,t,x=map(int, sys.stdin.readline().split())
	heappush( event, (x, max(0,s-x) , max(0,t-1-x)) )


D=[ int(sys.stdin.readline().strip()) for _ in range(Q) ]
D.sort()
ans=[ float("inf") for _ in range(Q) ]

Next=[ i+1 for i in range(Q) ]	#Next


while event:
	x,s,t=heappop(event)
	start=bisect_left(D,s)
	end=bisect_right(D,t)

	i=start
	while i<end:
		ans[i]=min(ans[i],x)
		next=Next[i]
		Next[i]=end
		i=next

for x in ans:
	if x==float("inf"):
		print -1
	else:
		print x

