import heapq

def main():
    N, Q = map(int, input().split())
    STX = [tuple(map(int, input().split())) for _ in range(N)]
    ev = []
    for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
    ev.sort(reverse=True)
    bar = []
    dead = {}

    for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1)

main() import heapq heapq def main():
    N, Q = map(int, input().split())
    STX = [tuple(map(int, input().split())) for _ in range(N)]
    ev = []
    for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
    ev.sort(reverse=True)
    bar = []
    dead = {}

    for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1) main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tuple(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split STX = [tuple(map(int, input().split())) for _ in range(N)] STX [tuple(map(int, input().split())) for _ in range(N)] ev = [] ev [] for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
     s t x STX ev.append((s - x, True, x)) ev.append ev append (s - x, True, x) s - x s x True x ev.append((t - x, False, x)) ev.append ev append (t - x, False, x) t - x t x False x ev.sort(reverse=True) ev.sort ev sort reverse=True reverse True bar = [] bar [] dead = {} dead {} for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1) d [int(input()) for _ in range(Q)] while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
         ev and ev[-1][0] <= d ev ev[-1][0] <= d ev[-1][0] [-1] ev -1 0 d t, a, x = ev.pop() t ev.pop() ev.pop ev pop a x if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
         a heapq.heappush(bar, x) heapq.heappush heapq heappush bar x dead[x] = dead.get(x, 0) + 1 dead[x] dead x dead.get(x, 0) + 1 dead.get(x, 0) dead.get dead get x 0 1 while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
         bar and bar[0] in dead bar bar[0] in dead bar[0] bar 0 dead x = heapq.heappop(bar) x heapq.heappop(bar) heapq.heappop heapq heappop bar if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
         dead[x] == 1 dead[x] dead x 1 del dead[x] dead[x] dead x dead[x] = dead[x] - 1 dead[x] dead x dead[x] - 1 dead[x] dead x 1 print(bar[0] if bar else -1) print bar[0] if bar else -1 bar bar[0] bar 0 -1 main() main def main():
    N, Q = map(int, input().split())
    STX = [tuple(map(int, input().split())) for _ in range(N)]
    ev = []
    for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
    ev.sort(reverse=True)
    bar = []
    dead = {}

    for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1) def main():
    N, Q = map(int, input().split())
    STX = [tuple(map(int, input().split())) for _ in range(N)]
    ev = []
    for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
    ev.sort(reverse=True)
    bar = []
    dead = {}

    for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1) main
import heapq

def main():
    N, Q = map(int, input().split())
    STX = [tuple(map(int, input().split())) for _ in range(N)]
    ev = []
    for s, t, x in STX:
        ev.append((s - x, True, x))
        ev.append((t - x, False, x))
    ev.sort(reverse=True)
    bar = []
    dead = {}

    for d in [int(input()) for _ in range(Q)]:
        while ev and ev[-1][0] <= d:
            t, a, x = ev.pop()
            if a:
                heapq.heappush(bar, x)
            else:
                dead[x] = dead.get(x, 0) + 1
                while bar and bar[0] in dead:
                    x = heapq.heappop(bar)
                    if dead[x] == 1:
                        del dead[x]
                    else:
                        dead[x] = dead[x] - 1
        print(bar[0] if bar else -1)

main()
