from heapq import heappush, heappop

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

for _ in range(N):
    S, T, X = map(int, input().split())
    l += [(S-X, 1, X), (T-X, 0, X)]
for i in range(Q):
    l += [(int(input()), 2, i)]
l.sort()

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

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

for _ in range(N):
    S, T, X = map(int, input().split())
    l += [(S-X, 1, X), (T-X, 0, X)]
for i in range(Q):
    l += [(int(input()), 2, i)]
l.sort()

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