import sys
from heapq import heappush, heappop
input = sys.stdin.readline
data = []
n,q = map(int,input().split())
for i in range(n):
    s, t, x = map(int, input().split())
    data.append([s-x,t-x,x])
data.sort(key=lambda x:x[0])
d_index = 0
candidate_x = []
inf = float("inf")
data += [[inf,inf,inf]]
for i in range(q):
    d = int(input())
    while d >= data[d_index][0]:
        heappush(candidate_x, (data[d_index][2], data[d_index][1]))
        d_index += 1
    if len(candidate_x) == 0:
        print(-1)
    else:
        while candidate_x:
            x,finish_t = heappop(candidate_x)
            if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
        else:
            print(-1)


 import sys sys from heapq import heappush, heappop input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline data = [] data [] n,q = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q for i in range(n):
    s, t, x = map(int, input().split())
    data.append([s-x,t-x,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 data.append([s-x,t-x,x]) data.append data append [s-x,t-x,x] s-x s x t-x t x x data.sort(key=lambda x:x[0]) data.sort data sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x d_index = 0 d_index 0 candidate_x = [] candidate_x [] inf = float("inf") inf float("inf") float "inf" data += [[inf,inf,inf]] data [[inf,inf,inf]] [inf,inf,inf] inf inf inf for i in range(q):
    d = int(input())
    while d >= data[d_index][0]:
        heappush(candidate_x, (data[d_index][2], data[d_index][1]))
        d_index += 1
    if len(candidate_x) == 0:
        print(-1)
    else:
        while candidate_x:
            x,finish_t = heappop(candidate_x)
            if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
        else:
            print(-1) i range(q) range q d = int(input()) d int(input()) int input() input while d >= data[d_index][0]:
        heappush(candidate_x, (data[d_index][2], data[d_index][1]))
        d_index += 1
     d >= data[d_index][0] d data[d_index][0] [d_index] data d_index 0 heappush(candidate_x, (data[d_index][2], data[d_index][1])) heappush candidate_x (data[d_index][2], data[d_index][1]) data[d_index][2] [d_index] data d_index 2 data[d_index][1] [d_index] data d_index 1 d_index += 1 d_index 1 if len(candidate_x) == 0:
        print(-1)
    else:
        while candidate_x:
            x,finish_t = heappop(candidate_x)
            if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
        else:
            print(-1) len(candidate_x) == 0 len(candidate_x) len candidate_x 0 print(-1) print -1 while candidate_x:
            x,finish_t = heappop(candidate_x)
            if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
        else:
            print(-1) candidate_x x,finish_t = heappop(candidate_x) x heappop(candidate_x) heappop candidate_x finish_t if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
         finish_t > d finish_t d heappush(candidate_x, (x, finish_t)) heappush candidate_x (x, finish_t) x finish_t print(x) print x break print(-1) print -1 d_index = 0 0 d_index candidate_x = [] [] candidate_x q = map(int,input().split()) map(int,input().split()) q t, x = map(int, input().split()) map(int, input().split()) t d_index += 1 1 d_index finish_t = heappop(candidate_x) heappop(candidate_x) finish_t input = sys.stdin.readline sys.stdin.readline input s, t, x = map(int, input().split()) map(int, input().split()) s inf = float("inf") float("inf") inf x,finish_t = heappop(candidate_x) heappop(candidate_x) x x = map(int, input().split()) map(int, input().split()) x d = int(input()) int(input()) d data = [] [] data n,q = map(int,input().split()) map(int,input().split()) n data += [[inf,inf,inf]] [[inf,inf,inf]] data
import sys
from heapq import heappush, heappop
input = sys.stdin.readline
data = []
n,q = map(int,input().split())
for i in range(n):
    s, t, x = map(int, input().split())
    data.append([s-x,t-x,x])
data.sort(key=lambda x:x[0])
d_index = 0
candidate_x = []
inf = float("inf")
data += [[inf,inf,inf]]
for i in range(q):
    d = int(input())
    while d >= data[d_index][0]:
        heappush(candidate_x, (data[d_index][2], data[d_index][1]))
        d_index += 1
    if len(candidate_x) == 0:
        print(-1)
    else:
        while candidate_x:
            x,finish_t = heappop(candidate_x)
            if finish_t > d:
                heappush(candidate_x, (x, finish_t))
                print(x)
                break
        else:
            print(-1)



