def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left

    N, Q = map(int, input().split())
    c = []
    c_append = c.append
    for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
    c.sort()

    D = [int(input()) for _ in range(Q)]

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

    for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

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

if __name__ == '__main__':
    main() def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left

    N, Q = map(int, input().split())
    c = []
    c_append = c.append
    for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
    c.sort()

    D = [int(input()) for _ in range(Q)]

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

    for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

    print ('\n'.join(map(str, ans))) main import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q c = [] c [] c_append = c.append c_append c.append c append for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
     _ range(N) range N s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x c_append((x, s, t)) c_append (x, s, t) x s t c.sort() c.sort c sort int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

     x s t c left = bisect_left(D, s - x) left bisect_left(D, s - x) bisect_left D s - x s x right = bisect_left(D, t - x) right bisect_left(D, t - x) bisect_left D t - x t x while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

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

     skip[left] == -1 skip[left] skip left -1 ans[left] = x ans[left] ans left x skip[left] = right skip[left] skip left right left += 1 left 1 left = skip[left] left skip[left] skip left 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():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left

    N, Q = map(int, input().split())
    c = []
    c_append = c.append
    for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
    c.sort()

    D = [int(input()) for _ in range(Q)]

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

    for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

    print ('\n'.join(map(str, ans))) def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left

    N, Q = map(int, input().split())
    c = []
    c_append = c.append
    for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
    c.sort()

    D = [int(input()) for _ in range(Q)]

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

    for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

    print ('\n'.join(map(str, ans))) main
def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left

    N, Q = map(int, input().split())
    c = []
    c_append = c.append
    for _ in range(N):
        s, t, x = map(int, input().split())
        c_append((x, s, t))
    c.sort()

    D = [int(input()) for _ in range(Q)]

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

    for x, s, t in c:
        left = bisect_left(D, s - x)
        right = bisect_left(D, t - x)
        while left < right:
            if skip[left] == -1:
                ans[left] = x
                skip[left] = right
                left += 1
            else:
                left = skip[left]

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

if __name__ == '__main__':
    main()