#!/usr/bin/env python3
#ABC128 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,q = LI()
stx = [LI() for _ in range(n)]
d = [I() for _ in range(q)]
stx.sort(key = lambda x:(x[2],x[0]))
ans = [-1]*q
skip = [-1]*q
for s,t,x in stx:
    l = bl(d,s-x)
    r = bl(d,t-x)
    while l < r:
        if ans[l] < 0:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l]
print(*ans)
 import sys sys import math math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collections import deque from operator import itemgetter from itertools import permutations mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 inf = float('inf') inf float('inf') float 'inf' def I(): return int(sys.stdin.readline()) I def LI(): return list(map(int,sys.stdin.readline().split())) LI n,q = LI() n LI() LI q LI() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI() LI stx = [LI() for _ in range(n)] stx [LI() for _ in range(n)] I() for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) I() I d = [I() for _ in range(q)] d [I() for _ in range(q)] stx.sort(key = lambda x:(x[2],x[0])) stx.sort stx sort key = lambda x:(x[2],x[0]) key lambda x:(x[2],x[0]) (x[2],x[0]) x[2] x 2 x[0] x 0 x ans = [-1]*q ans [-1]*q [-1] -1 q skip = [-1]*q skip [-1]*q [-1] -1 q for s,t,x in stx:
    l = bl(d,s-x)
    r = bl(d,t-x)
    while l < r:
        if ans[l] < 0:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l] s t x stx l = bl(d,s-x) l bl(d,s-x) bl d s-x s x r = bl(d,t-x) r bl(d,t-x) bl d t-x t x while l < r:
        if ans[l] < 0:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l] l < r l r if ans[l] < 0:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l] ans[l] < 0 ans[l] ans l 0 skip[l] = r skip[l] skip l r ans[l] = x ans[l] ans l x l += 1 l 1 l = skip[l] l skip[l] skip l print(*ans) print *ans ans stx = [LI() for _ in range(n)] [LI() for _ in range(n)] stx skip = [-1]*q [-1]*q skip r = bl(d,t-x) bl(d,t-x) r mod = 10**9 + 7 10**9 + 7 mod inf = float('inf') float('inf') inf d = [I() for _ in range(q)] [I() for _ in range(q)] d l += 1 1 l def LI(): return list(map(int,sys.stdin.readline().split())) def LI(): return list(map(int,sys.stdin.readline().split())) LI l = skip[l] skip[l] l def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I n,q = LI() LI() n ans = [-1]*q [-1]*q ans q = LI() LI() q l = bl(d,s-x) bl(d,s-x) l
#!/usr/bin/env python3
#ABC128 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,q = LI()
stx = [LI() for _ in range(n)]
d = [I() for _ in range(q)]
stx.sort(key = lambda x:(x[2],x[0]))
ans = [-1]*q
skip = [-1]*q
for s,t,x in stx:
    l = bl(d,s-x)
    r = bl(d,t-x)
    while l < r:
        if ans[l] < 0:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l]
print(*ans)

