#48 ABC128E
#イベントソート   
import sys
input = sys.stdin.readline

n,q=map(int,input().split())
stx=[list(map(int,input().split())) for _ in range(n)]
d=[int(input()) for _ in range(q)]

stx=sorted(stx,key=lambda x:x[2])

ans=[-1 for _ in range(q)]
skip=[-1 for _ in range(q)]

from bisect import bisect_left

for s,t,x in stx:
	left=bisect_left(d,s-x)
	right=bisect_left(d,t-x)
	while left<right:
		if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left]
print('\n'.join(map(str,ans))) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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)] stx=sorted(stx,key=lambda x:x[2]) stx sorted(stx,key=lambda x:x[2]) sorted stx key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x -1 for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) -1 ans=[-1 for _ in range(q)] ans [-1 for _ in range(q)] -1 for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) -1 skip=[-1 for _ in range(q)] skip [-1 for _ in range(q)] from bisect import bisect_left for s,t,x in stx:
	left=bisect_left(d,s-x)
	right=bisect_left(d,t-x)
	while left<right:
		if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left] s t x stx left=bisect_left(d,s-x) left bisect_left(d,s-x) bisect_left d s-x s x right=bisect_left(d,t-x) right bisect_left(d,t-x) bisect_left d t-x t x while left<right:
		if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left] left<right left right if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left] skip[left]==-1 skip[left] skip left -1 ans[left]=x ans[left] ans left x skip[left]=right skip[left] skip left right left+=1 left 1 left=skip[left] left skip[left] skip left print('\n'.join(map(str,ans))) print '\n'.join(map(str,ans)) '\n'.join '\n' join map(str,ans) map str ans stx=sorted(stx,key=lambda x:x[2]) sorted(stx,key=lambda x:x[2]) stx right=bisect_left(d,t-x) bisect_left(d,t-x) right left=skip[left] skip[left] left n,q=map(int,input().split()) map(int,input().split()) n q=map(int,input().split()) map(int,input().split()) q ans=[-1 for _ in range(q)] [-1 for _ in range(q)] ans left=bisect_left(d,s-x) bisect_left(d,s-x) left input = sys.stdin.readline sys.stdin.readline input skip=[-1 for _ in range(q)] [-1 for _ in range(q)] skip left+=1 1 left stx=[list(map(int,input().split())) for _ in range(n)] [list(map(int,input().split())) for _ in range(n)] stx d=[int(input()) for _ in range(q)] [int(input()) for _ in range(q)] d
#48 ABC128E
#イベントソート   
import sys
input = sys.stdin.readline

n,q=map(int,input().split())
stx=[list(map(int,input().split())) for _ in range(n)]
d=[int(input()) for _ in range(q)]

stx=sorted(stx,key=lambda x:x[2])

ans=[-1 for _ in range(q)]
skip=[-1 for _ in range(q)]

from bisect import bisect_left

for s,t,x in stx:
	left=bisect_left(d,s-x)
	right=bisect_left(d,t-x)
	while left<right:
		if skip[left]==-1:
			ans[left]=x
			skip[left]=right
			left+=1
		else:
			left=skip[left]
print('\n'.join(map(str,ans)))