from bisect import bisect_left


def main():
    N, Q, *I = map(int, open(0).read().split())
    STX, D = I[:3 * N], I[3 * N:]

    E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2])

    R = [-1] * Q
    ans = [-1] * Q

    for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

    print("\n".join(map(str, ans)))


if __name__ == '__main__':
    main() from bisect import bisect_left def main():
    N, Q, *I = map(int, open(0).read().split())
    STX, D = I[:3 * N], I[3 * N:]

    E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2])

    R = [-1] * Q
    ans = [-1] * Q

    for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

    print("\n".join(map(str, ans))) main N, Q, *I = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split Q *I I STX, D = I[:3 * N], I[3 * N:] STX I[:3 * N] I :3 * N 3 * N 3 N D I[3 * N:] I 3 * N: 3 * N 3 N E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2]) E sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2]) sorted zip(*[iter(STX)] * 3) zip *[iter(STX)] * 3 [iter(STX)] * 3 [iter(STX)] iter(STX) iter STX 3 key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x R = [-1] * Q R [-1] * Q [-1] -1 Q ans = [-1] * Q ans [-1] * Q [-1] -1 Q for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

     s t x E 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:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

     l < r l r if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

     R[l] == -1 R[l] R l -1 ans[l] = x ans[l] ans l x R[l] = r R[l] R l r l += 1 l 1 l = R[l] l R[l] R l print("\n".join(map(str, ans))) print "\n".join(map(str, ans)) "\n".join "\n" join map(str, ans) map str ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N, Q, *I = map(int, open(0).read().split())
    STX, D = I[:3 * N], I[3 * N:]

    E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2])

    R = [-1] * Q
    ans = [-1] * Q

    for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

    print("\n".join(map(str, ans))) def main():
    N, Q, *I = map(int, open(0).read().split())
    STX, D = I[:3 * N], I[3 * N:]

    E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2])

    R = [-1] * Q
    ans = [-1] * Q

    for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

    print("\n".join(map(str, ans))) main
from bisect import bisect_left


def main():
    N, Q, *I = map(int, open(0).read().split())
    STX, D = I[:3 * N], I[3 * N:]

    E = sorted(zip(*[iter(STX)] * 3), key=lambda x: x[2])

    R = [-1] * Q
    ans = [-1] * Q

    for s, t, x in E:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        while l < r:
            if R[l] == -1:
                ans[l] = x
                R[l] = r
                l += 1
            else:
                l = R[l]

    print("\n".join(map(str, ans)))


if __name__ == '__main__':
    main()
