import sys
input = sys.stdin.buffer.readline

N,Q = map(int, input().split())
List = []
dic = {}
for _ in range(N):
    s, t, x = map(int, input().split())
    List.append((s-0.5-x, 1, x))
    List.append((t-0.5-x, -1, x))
    dic[x] = False

import heapq
    
List.sort()

h = []
j = 0
for _ in range(Q):
    D = int(input())
    while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
    while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
    if not h:
        print(-1) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline N,Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q List = [] List [] dic = {} dic {} for _ in range(N):
    s, t, x = map(int, input().split())
    List.append((s-0.5-x, 1, x))
    List.append((t-0.5-x, -1, x))
    dic[x] = False _ 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 List.append((s-0.5-x, 1, x)) List.append List append (s-0.5-x, 1, x) s-0.5-x s-0.5 s 0.5 x 1 x List.append((t-0.5-x, -1, x)) List.append List append (t-0.5-x, -1, x) t-0.5-x t-0.5 t 0.5 x -1 x dic[x] = False dic[x] dic x False import heapq heapq List.sort() List.sort List sort h = [] h [] j = 0 j 0 for _ in range(Q):
    D = int(input())
    while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
    while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
    if not h:
        print(-1) _ range(Q) range Q D = int(input()) D int(input()) int input() input while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
     j < 2*N and List[j][0] < D j < 2*N j 2*N 2 N List[j][0] < D List[j][0] [j] List j 0 D if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
         List[j][1] == 1 List[j][1] [j] List j 1 1 heapq.heappush(h, List[j][2]) heapq.heappush heapq heappush h List[j][2] [j] List j 2 dic[List[j][2]] = True dic[List[j][2]] dic List[j][2] [j] List j 2 True dic[List[j][2]] = False dic[List[j][2]] dic List[j][2] [j] List j 2 False j += 1 j 1 while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
     h ans = h[0] ans h[0] h 0 if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
     dic[ans] dic ans print(ans) print ans break heapq.heappop(h) heapq.heappop heapq heappop h if not h:
        print(-1) not h h print(-1) print -1 x = map(int, input().split()) map(int, input().split()) x ans = h[0] h[0] ans t, x = map(int, input().split()) map(int, input().split()) t D = int(input()) int(input()) D j += 1 1 j dic = {} {} dic h = [] [] h input = sys.stdin.buffer.readline sys.stdin.buffer.readline input s, t, x = map(int, input().split()) map(int, input().split()) s Q = map(int, input().split()) map(int, input().split()) Q List = [] [] List j = 0 0 j N,Q = map(int, input().split()) map(int, input().split()) N
import sys
input = sys.stdin.buffer.readline

N,Q = map(int, input().split())
List = []
dic = {}
for _ in range(N):
    s, t, x = map(int, input().split())
    List.append((s-0.5-x, 1, x))
    List.append((t-0.5-x, -1, x))
    dic[x] = False

import heapq
    
List.sort()

h = []
j = 0
for _ in range(Q):
    D = int(input())
    while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
    while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
    if not h:
        print(-1)