import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

#################

from operator import itemgetter
from bisect import bisect_left

class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
      
N,Q = II()
a = []
for _ in range(N):
    s,t,x = II()
    a.append((x, s-x-0.5, t-x-0.5))
D = Line(Q,1)
 
a.sort(key=itemgetter(0),reverse=True)
 
seg = Range_SegmentTree(Q)
for i,b in enumerate(a):
    l = bisect_left(D,b[1])
    r = bisect_left(D,b[2])
    seg.update(l,r-1,(i,b[0]))
    
for i in range(Q):
    x = seg.query(i)
    if x == 2**31-1:
        print(-1)
    else:
        print(x) import sys sys import math math from collections import defaultdict sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def I(): return int(input()) I def II(): return map(int, input().split()) II def III(): return list(map(int, input().split())) III def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

################# Line if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

################# N<=0 N 0 for _ in range(num): return []
     _ range(num) range num elif num==1:
        return [I() for _ in range(N)]
     num==1 num 1 I() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) I() I return [I() for _ in range(N)] [I() for _ in range(N)] tuple(II()) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(II()) tuple II() II read_all = [tuple(II()) for _ in range(N)] read_all [tuple(II()) for _ in range(N)] return map(list,zip(*read_all)) map(list,zip(*read_all)) map list zip(*read_all) zip *read_all read_all N N num num from operator import itemgetter from bisect import bisect_left class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
       Range_SegmentTree def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
     __init__ self.N0 = 2**(N-1).bit_length() self.N0 self N0 2**(N-1).bit_length() 2 (N-1).bit_length() N-1).bit_length N-1 N 1 bit_length self.tree = [None]*(2*self.N0) self.tree self tree [None]*(2*self.N0) [None] None 2*self.N0 2 self.N0 self N0 self.INF = (-1, 2**31-1) self.INF self INF (-1, 2**31-1) -1 2**31-1 2**31 2 31 1 self self N N def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
     update L = l + self.N0 L l + self.N0 l self.N0 self N0 R = r + self.N0 + 1 R r + self.N0 + 1 r + self.N0 r self.N0 self N0 1 while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
     L < R L R if R & 1:
                R -= 1
                self.tree[R-1] = v
             R & 1 R 1 R -= 1 R 1 self.tree[R-1] = v self.tree[R-1] self.tree self tree R-1 R 1 v if L & 1:
                self.tree[L-1] = v
                L += 1
             L & 1 L 1 self.tree[L-1] = v self.tree[L-1] self.tree self tree L-1 L 1 v L += 1 L 1 L >>= 1 L 1 R >>= 1 R 1 self self l l r r v v def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
     _query k += self.N0-1 k self.N0-1 self.N0 self N0 1 s = self.INF s self.INF self INF while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
         k >= 0 k 0 if self.tree[k]:
                s = max(s, self.tree[k])
             self.tree[k] self.tree self tree k s = max(s, self.tree[k]) s max(s, self.tree[k]) max s self.tree[k] self.tree self tree k k = (k - 1) // 2 k (k - 1) // 2 k - 1 k 1 2 return s s self self k k def query(self,k):
        return self._query(k)[1]
       query return self._query(k)[1] self._query(k)[1] self._query(k) self._query self _query k 1 self self k k N,Q = II() N II() II Q a = [] a [] for _ in range(N):
    s,t,x = II()
    a.append((x, s-x-0.5, t-x-0.5)) _ range(N) range N s,t,x = II() s II() II t x a.append((x, s-x-0.5, t-x-0.5)) a.append a append (x, s-x-0.5, t-x-0.5) x s-x-0.5 s-x s x 0.5 t-x-0.5 t-x t x 0.5 D = Line(Q,1) D Line(Q,1) Line Q 1 a.sort(key=itemgetter(0),reverse=True) a.sort a sort key=itemgetter(0) key itemgetter(0) itemgetter 0 reverse=True reverse True seg = Range_SegmentTree(Q) seg Range_SegmentTree(Q) Range_SegmentTree Q for i,b in enumerate(a):
    l = bisect_left(D,b[1])
    r = bisect_left(D,b[2])
    seg.update(l,r-1,(i,b[0]))
     i b enumerate(a) enumerate a l = bisect_left(D,b[1]) l bisect_left(D,b[1]) bisect_left D b[1] b 1 r = bisect_left(D,b[2]) r bisect_left(D,b[2]) bisect_left D b[2] b 2 seg.update(l,r-1,(i,b[0])) seg.update seg update l r-1 r 1 (i,b[0]) i b[0] b 0 for i in range(Q):
    x = seg.query(i)
    if x == 2**31-1:
        print(-1)
    else:
        print(x) i range(Q) range Q x = seg.query(i) x seg.query(i) seg.query seg query i if x == 2**31-1:
        print(-1)
    else:
        print(x) x == 2**31-1 x 2**31-1 2**31 2 31 1 print(-1) print -1 print(x) print x def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

################# def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

################# Line def II(): return map(int, input().split()) def II(): return map(int, input().split()) II t,x = II() II() t l = bisect_left(D,b[1]) bisect_left(D,b[1]) l s,t,x = II() II() s D = Line(Q,1) Line(Q,1) D seg = Range_SegmentTree(Q) Range_SegmentTree(Q) seg Q = II() II() Q x = II() II() x a = [] [] a mod = 10**9 + 7 10**9 + 7 mod r = bisect_left(D,b[2]) bisect_left(D,b[2]) r def III(): return list(map(int, input().split())) def III(): return list(map(int, input().split())) III N,Q = II() II() N def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input x = seg.query(i) seg.query(i) x def I(): return int(input()) def I(): return int(input()) I class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
       class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
       Range_SegmentTree
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

#################

from operator import itemgetter
from bisect import bisect_left

class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
      
N,Q = II()
a = []
for _ in range(N):
    s,t,x = II()
    a.append((x, s-x-0.5, t-x-0.5))
D = Line(Q,1)
 
a.sort(key=itemgetter(0),reverse=True)
 
seg = Range_SegmentTree(Q)
for i,b in enumerate(a):
    l = bisect_left(D,b[1])
    r = bisect_left(D,b[2])
    seg.update(l,r-1,(i,b[0]))
    
for i in range(Q):
    x = seg.query(i)
    if x == 2**31-1:
        print(-1)
    else:
        print(x)