from bisect import bisect_left

def solve(n, q, s, t, x, d):
    v = sorted(list(zip(s, t, x)), key=lambda _:_[2])
    res = [-1] * q
    jump = [-1] * q
    for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
    return res

n, q = map(int, input().split())
s = [-1] * n
t = [-1] * n
x = [-1] * n
for i in range(n):
    s[i], t[i], x[i] = map(int, input().split())
d = [int(input()) for i in range(q)]

print(*solve(n, q, s, t, x , d), sep="\n") from bisect import bisect_left def solve(n, q, s, t, x, d):
    v = sorted(list(zip(s, t, x)), key=lambda _:_[2])
    res = [-1] * q
    jump = [-1] * q
    for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
    return res solve v = sorted(list(zip(s, t, x)), key=lambda _:_[2]) v sorted(list(zip(s, t, x)), key=lambda _:_[2]) sorted list(zip(s, t, x)) list zip(s, t, x) zip s t x key=lambda _:_[2] key lambda _:_[2] _[2] _ 2 _ res = [-1] * q res [-1] * q [-1] -1 q jump = [-1] * q jump [-1] * q [-1] -1 q for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
     s t x v l = bisect_left(d, s - x) l bisect_left(d, s - x) bisect_left d s - x s x r = bisect_left(d, t - x) r bisect_left(d, t - x) bisect_left d t - x t x while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
     l < r l r s = jump[l] s jump[l] jump l if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
     s == -1 s -1 res[l] = x res[l] res l x jump[l] = r jump[l] jump l r l += 1 l 1 l = s l s return res res n n q q s s t t x x d d n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q s = [-1] * n s [-1] * n [-1] -1 n t = [-1] * n t [-1] * n [-1] -1 n x = [-1] * n x [-1] * n [-1] -1 n for i in range(n):
    s[i], t[i], x[i] = map(int, input().split()) i range(n) range n s[i], t[i], x[i] = map(int, input().split()) s[i] s i map(int, input().split()) map int input().split() ().split () input split t[i] t i x[i] x i 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)] print(*solve(n, q, s, t, x , d), sep="\n") print *solve(n, q, s, t, x , d) solve(n, q, s, t, x , d) solve n q s t x d sep="\n" sep "\n" def solve(n, q, s, t, x, d):
    v = sorted(list(zip(s, t, x)), key=lambda _:_[2])
    res = [-1] * q
    jump = [-1] * q
    for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
    return res def solve(n, q, s, t, x, d):
    v = sorted(list(zip(s, t, x)), key=lambda _:_[2])
    res = [-1] * q
    jump = [-1] * q
    for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
    return res solve n, q = map(int, input().split()) map(int, input().split()) n s = [-1] * n [-1] * n s x = [-1] * n [-1] * n x t = [-1] * n [-1] * n t q = map(int, input().split()) map(int, input().split()) q d = [int(input()) for i in range(q)] [int(input()) for i in range(q)] d
from bisect import bisect_left

def solve(n, q, s, t, x, d):
    v = sorted(list(zip(s, t, x)), key=lambda _:_[2])
    res = [-1] * q
    jump = [-1] * q
    for s, t, x in v:
        l = bisect_left(d, s - x)
        r = bisect_left(d, t - x)
        while l < r:
            s = jump[l]
            if s == -1:
                res[l] = x
                jump[l] = r
                l += 1
            else:
                l = s
    return res

n, q = map(int, input().split())
s = [-1] * n
t = [-1] * n
x = [-1] * n
for i in range(n):
    s[i], t[i], x[i] = map(int, input().split())
d = [int(input()) for i in range(q)]

print(*solve(n, q, s, t, x , d), sep="\n")