import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


from bisect import bisect_left

n, q = li()

stx = [list(li()) for _ in range(n)]
d = [ni() for _ in range(q)]

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

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

for si, ti, xi in stx:
    left = bisect_left(d, si-xi)
    right = bisect_left(d, ti-xi)

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

        else:
            left = skip[left]

print(*ans, sep="\n") import sys sys stdin = sys.stdin stdin sys.stdin sys stdin sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 def li(): return map(int, stdin.readline().split()) li def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) li_ def lf(): return map(float, stdin.readline().split()) lf def ls(): return stdin.readline().split() ls def ns(): return stdin.readline().rstrip() ns def lc(): return list(ns()) lc def ni(): return int(stdin.readline()) ni def nf(): return float(stdin.readline()) nf from bisect import bisect_left n, q = li() n li() li q list(li()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(li()) list li() li stx = [list(li()) for _ in range(n)] stx [list(li()) for _ in range(n)] ni() for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) ni() ni d = [ni() for _ in range(q)] d [ni() for _ 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 si, ti, xi in stx:
    left = bisect_left(d, si-xi)
    right = bisect_left(d, ti-xi)

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

        else:
            left = skip[left] si ti xi stx left = bisect_left(d, si-xi) left bisect_left(d, si-xi) bisect_left d si-xi si xi right = bisect_left(d, ti-xi) right bisect_left(d, ti-xi) bisect_left d ti-xi ti xi while left < right:
        if skip[left] == -1:
            ans[left] = xi
            skip[left] = right
            left += 1

        else:
            left = skip[left] left < right left right if skip[left] == -1:
            ans[left] = xi
            skip[left] = right
            left += 1

        else:
            left = skip[left] skip[left] == -1 skip[left] skip left -1 ans[left] = xi ans[left] ans left xi skip[left] = right skip[left] skip left right left += 1 left 1 left = skip[left] left skip[left] skip left print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" q = li() li() q left = skip[left] skip[left] left stx = [list(li()) for _ in range(n)] [list(li()) for _ in range(n)] stx ans = [-1]*q [-1]*q ans n, q = li() li() n skip = [-1]*q [-1]*q skip def nf(): return float(stdin.readline()) def nf(): return float(stdin.readline()) nf stdin = sys.stdin sys.stdin stdin left += 1 1 left def ls(): return stdin.readline().split() def ls(): return stdin.readline().split() ls def ns(): return stdin.readline().rstrip() def ns(): return stdin.readline().rstrip() ns left = bisect_left(d, si-xi) bisect_left(d, si-xi) left def lc(): return list(ns()) def lc(): return list(ns()) lc def ni(): return int(stdin.readline()) def ni(): return int(stdin.readline()) ni right = bisect_left(d, ti-xi) bisect_left(d, ti-xi) right d = [ni() for _ in range(q)] [ni() for _ in range(q)] d def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) li_ def lf(): return map(float, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) lf def li(): return map(int, stdin.readline().split()) def li(): return map(int, stdin.readline().split()) li
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


from bisect import bisect_left

n, q = li()

stx = [list(li()) for _ in range(n)]
d = [ni() for _ in range(q)]

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

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

for si, ti, xi in stx:
    left = bisect_left(d, si-xi)
    right = bisect_left(d, ti-xi)

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

        else:
            left = skip[left]

print(*ans, sep="\n")