import sys
from bisect import bisect_left

n,q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
    s,t,x = map(int, line.split())
    c.append((x,s,t))
c.sort()
d = list(map(int,lines[n:]))

ans = [-1] * q
skip = [-1] * q
for x,s,t in c:
    ss = bisect_left(d,s-x)
    tt = bisect_left(d,t-x)
    while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss]
print(*ans,sep='\n') import sys sys from bisect import bisect_left n,q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines c = [] c [] for line in lines[:n]:
    s,t,x = map(int, line.split())
    c.append((x,s,t)) line lines[:n] lines :n n s,t,x = map(int, line.split()) s map(int, line.split()) map int line.split() line.split line split t x c.append((x,s,t)) c.append c append (x,s,t) x s t c.sort() c.sort c sort d = list(map(int,lines[n:])) d list(map(int,lines[n:])) list map(int,lines[n:]) map int lines[n:] lines n: n ans = [-1] * q ans [-1] * q [-1] -1 q skip = [-1] * q skip [-1] * q [-1] -1 q for x,s,t in c:
    ss = bisect_left(d,s-x)
    tt = bisect_left(d,t-x)
    while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss] x s t c ss = bisect_left(d,s-x) ss bisect_left(d,s-x) bisect_left d s-x s x tt = bisect_left(d,t-x) tt bisect_left(d,t-x) bisect_left d t-x t x while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss] ss < tt ss tt if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss] skip[ss] == -1 skip[ss] skip ss -1 ans[ss] = x ans[ss] ans ss x skip[ss] = tt skip[ss] skip ss tt ss += 1 ss 1 ss = skip[ss] ss skip[ss] skip ss print(*ans,sep='\n') print *ans ans sep='\n' sep '\n' lines = sys.stdin.readlines() sys.stdin.readlines() lines s,t,x = map(int, line.split()) map(int, line.split()) s x = map(int, line.split()) map(int, line.split()) x d = list(map(int,lines[n:])) list(map(int,lines[n:])) d t,x = map(int, line.split()) map(int, line.split()) t c = [] [] c ss = bisect_left(d,s-x) bisect_left(d,s-x) ss tt = bisect_left(d,t-x) bisect_left(d,t-x) tt q = map(int, input().split()) map(int, input().split()) q n,q = map(int, input().split()) map(int, input().split()) n skip = [-1] * q [-1] * q skip ss = skip[ss] skip[ss] ss ans = [-1] * q [-1] * q ans ss += 1 1 ss
import sys
from bisect import bisect_left

n,q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
    s,t,x = map(int, line.split())
    c.append((x,s,t))
c.sort()
d = list(map(int,lines[n:]))

ans = [-1] * q
skip = [-1] * q
for x,s,t in c:
    ss = bisect_left(d,s-x)
    tt = bisect_left(d,t-x)
    while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss]
print(*ans,sep='\n')
