import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

stx.sort(key=lambda x: x[2])

ans=[-1]*q
skip=[-1]*q

for i in range(n):
    s,t,x=stx[i]
    left=bisect.bisect_left(d, s-x)
    right=bisect.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 bisect bisect import copy copy import heapq heapq import math math import sys sys from collections import * from itertools import accumulate, combinations, permutations, product def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 def ruiseki(lst):
    return [0]+list(accumulate(lst)) ruiseki return [0]+list(accumulate(lst)) [0]+list(accumulate(lst)) [0] 0 list(accumulate(lst)) list accumulate(lst) accumulate lst lst lst mod=pow(10,9)+7 mod pow(10,9)+7 pow(10,9) pow 10 9 7 chr(ord('a') + i) for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(ord('a') + i) chr ord('a') + i ord('a') ord 'a' i al=[chr(ord('a') + i) for i in range(26)] al [chr(ord('a') + i) for i in range(26)] direction=[[1,0],[0,1],[-1,0],[0,-1]] direction [[1,0],[0,1],[-1,0],[0,-1]] [1,0] 1 0 [0,1] 0 1 [-1,0] -1 0 [0,-1] 0 -1 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 i in range(n) for i in range(n) i range(n) range n for i 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 i in range(n)] stx [list(map(int,input().split())) for i in range(n)] int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input d=[int(input()) for i in range(q)] d [int(input()) for i in range(q)] stx.sort(key=lambda x: x[2]) stx.sort stx sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x ans=[-1]*q ans [-1]*q [-1] -1 q skip=[-1]*q skip [-1]*q [-1] -1 q for i in range(n):
    s,t,x=stx[i]
    left=bisect.bisect_left(d, s-x)
    right=bisect.bisect_left(d, t-x)

    while left<right:
        if skip[left]==-1:
            ans[left]=x
            skip[left]=right
            left+=1

        else:
            left=skip[left]
     i range(n) range n s,t,x=stx[i] s stx[i] stx i t x left=bisect.bisect_left(d, s-x) left bisect.bisect_left(d, s-x) bisect.bisect_left bisect bisect_left d s-x s x right=bisect.bisect_left(d, t-x) right bisect.bisect_left(d, t-x) bisect.bisect_left bisect 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 def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input mod=pow(10,9)+7 pow(10,9)+7 mod direction=[[1,0],[0,1],[-1,0],[0,-1]] [[1,0],[0,1],[-1,0],[0,-1]] direction def ruiseki(lst):
    return [0]+list(accumulate(lst)) def ruiseki(lst):
    return [0]+list(accumulate(lst)) ruiseki skip=[-1]*q [-1]*q skip t,x=stx[i] stx[i] t right=bisect.bisect_left(d, t-x) bisect.bisect_left(d, t-x) right stx=[list(map(int,input().split())) for i in range(n)] [list(map(int,input().split())) for i in range(n)] stx ans=[-1]*q [-1]*q ans left=bisect.bisect_left(d, s-x) bisect.bisect_left(d, s-x) left al=[chr(ord('a') + i) for i in range(26)] [chr(ord('a') + i) for i in range(26)] al s,t,x=stx[i] stx[i] s left=skip[left] skip[left] left n,q=map(int,input().split()) map(int,input().split()) n x=stx[i] stx[i] x d=[int(input()) for i in range(q)] [int(input()) for i in range(q)] d q=map(int,input().split()) map(int,input().split()) q left+=1 1 left
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

stx.sort(key=lambda x: x[2])

ans=[-1]*q
skip=[-1]*q

for i in range(n):
    s,t,x=stx[i]
    left=bisect.bisect_left(d, s-x)
    right=bisect.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)))