from heapq import heappush, heappop

N, Q = map(int, input().split())
l = []
used = set()
q = []

for i in range(N):
    S, T, X = map(int, input().split())
    l.append((S-X, 1, X))
    l.append((T-X, 0, X))

for i in range(Q):
    l.append((int(input()), 2, i))

l.sort()

for pos, m, x in l:
    if m==0:
        used.remove(x)
    elif m==1:
        heappush(q, x)
        used.add(x)
    else:
        while q:
            if q[0] not in used:
                heappop(q)
            else:
                break
        print(q[0] if q else -1) from heapq import heappush, heappop N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q l = [] l [] used = set() used set() set q = [] q [] for i in range(N):
    S, T, X = map(int, input().split())
    l.append((S-X, 1, X))
    l.append((T-X, 0, X)) i 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 l.append((S-X, 1, X)) l.append l append (S-X, 1, X) S-X S X 1 X l.append((T-X, 0, X)) l.append l append (T-X, 0, X) T-X T X 0 X for i in range(Q):
    l.append((int(input()), 2, i)) i range(Q) range Q l.append((int(input()), 2, i)) l.append l append (int(input()), 2, i) int(input()) int input() input 2 i l.sort() l.sort l sort for pos, m, x in l:
    if m==0:
        used.remove(x)
    elif m==1:
        heappush(q, x)
        used.add(x)
    else:
        while q:
            if q[0] not in used:
                heappop(q)
            else:
                break
        print(q[0] if q else -1) pos m x l if m==0:
        used.remove(x)
    elif m==1:
        heappush(q, x)
        used.add(x)
    else:
        while q:
            if q[0] not in used:
                heappop(q)
            else:
                break
        print(q[0] if q else -1) m==0 m 0 used.remove(x) used.remove used remove x elif m==1:
        heappush(q, x)
        used.add(x)
     m==1 m 1 heappush(q, x) heappush q x used.add(x) used.add used add x while q:
            if q[0] not in used:
                heappop(q)
            else:
                break
         q if q[0] not in used:
                heappop(q)
            else:
                break
         q[0] not in used q[0] q 0 used heappop(q) heappop q break print(q[0] if q else -1) print q[0] if q else -1 q q[0] q 0 -1 N, Q = map(int, input().split()) map(int, input().split()) N l = [] [] l T, X = map(int, input().split()) map(int, input().split()) T Q = map(int, input().split()) map(int, input().split()) Q q = [] [] q used = set() set() used S, T, X = map(int, input().split()) map(int, input().split()) S X = map(int, input().split()) map(int, input().split()) X
from heapq import heappush, heappop

N, Q = map(int, input().split())
l = []
used = set()
q = []

for i in range(N):
    S, T, X = map(int, input().split())
    l.append((S-X, 1, X))
    l.append((T-X, 0, X))

for i in range(Q):
    l.append((int(input()), 2, i))

l.sort()

for pos, m, x in l:
    if m==0:
        used.remove(x)
    elif m==1:
        heappush(q, x)
        used.add(x)
    else:
        while q:
            if q[0] not in used:
                heappop(q)
            else:
                break
        print(q[0] if q else -1)
