def main():
    from bisect import bisect_left
    from collections import namedtuple
    from operator import attrgetter
    import sys

    input = sys.stdin.readline
    Event = namedtuple('Event', 'pos start end')

    N, Q = map(int, input().split())

    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
    events.sort(key=attrgetter('pos'))

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

    ans = [-1] * Q
    see = [-1] * Q
    for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
    print(*ans, sep='\n')


if __name__ == '__main__':
    main() def main():
    from bisect import bisect_left
    from collections import namedtuple
    from operator import attrgetter
    import sys

    input = sys.stdin.readline
    Event = namedtuple('Event', 'pos start end')

    N, Q = map(int, input().split())

    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
    events.sort(key=attrgetter('pos'))

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

    ans = [-1] * Q
    see = [-1] * Q
    for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
    print(*ans, sep='\n') main from bisect import bisect_left from collections import namedtuple from operator import attrgetter import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline Event = namedtuple('Event', 'pos start end') Event namedtuple('Event', 'pos start end') namedtuple 'Event' 'pos start end' N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q events = [] events [] for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
     _ 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 e = Event(pos=x, start=s - x, end=t - x) e Event(pos=x, start=s - x, end=t - x) Event pos=x pos x start=s - x start s - x s x end=t - x end t - x t x events.append(e) events.append events append e events.sort(key=attrgetter('pos')) events.sort events sort key=attrgetter('pos') key attrgetter('pos') attrgetter 'pos' 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 see = [-1] * Q see [-1] * Q [-1] -1 Q for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
     e events left = bisect_left(D, e.start) left bisect_left(D, e.start) bisect_left D e.start e start right = bisect_left(D, e.end) right bisect_left(D, e.end) bisect_left D e.end e end idx = left idx left while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
     idx < right idx right if ~ans[idx]:
                idx = see[idx]
                continue
             ~ans[idx] ans[idx] ans idx idx = see[idx] idx see[idx] see idx continue ans[idx] = e.pos ans[idx] ans idx e.pos e pos see[idx] = right see[idx] see idx right idx += 1 idx 1 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    from bisect import bisect_left
    from collections import namedtuple
    from operator import attrgetter
    import sys

    input = sys.stdin.readline
    Event = namedtuple('Event', 'pos start end')

    N, Q = map(int, input().split())

    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
    events.sort(key=attrgetter('pos'))

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

    ans = [-1] * Q
    see = [-1] * Q
    for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
    print(*ans, sep='\n') def main():
    from bisect import bisect_left
    from collections import namedtuple
    from operator import attrgetter
    import sys

    input = sys.stdin.readline
    Event = namedtuple('Event', 'pos start end')

    N, Q = map(int, input().split())

    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
    events.sort(key=attrgetter('pos'))

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

    ans = [-1] * Q
    see = [-1] * Q
    for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
    print(*ans, sep='\n') main
def main():
    from bisect import bisect_left
    from collections import namedtuple
    from operator import attrgetter
    import sys

    input = sys.stdin.readline
    Event = namedtuple('Event', 'pos start end')

    N, Q = map(int, input().split())

    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        e = Event(pos=x, start=s - x, end=t - x)  # 時間[s-x,t-x)にpos=0にいるとpos=xで工事中
        events.append(e)
    events.sort(key=attrgetter('pos'))

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

    ans = [-1] * Q
    see = [-1] * Q
    for e in events:
        left = bisect_left(D, e.start)
        right = bisect_left(D, e.end)
        # Dの要素で index が [left,right) 内のものは e.pos で工事中
        # e.pos 昇順ソートしているので, ans[idx] には工事中の最小のposが入る
        idx = left
        while idx < right:
            if ~ans[idx]:
                idx = see[idx]
                continue
            ans[idx] = e.pos
            see[idx] = right
            idx += 1
            
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()
