### BUGGY CODE ###

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(map(int, input().split())) for _ in range(N)]
        return map(list,zip(*read_all))

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

from operator import itemgetter
from bisect import bisect_left

#1-indexedの遅延評価セグメント木
class LazySegmentTree:
    def __init__(self,N,default=float('inf')):
        #演算の定義
        self.op = min
        #初期化の値
        self.default = default
        self.LV = (N-1).bit_length()
        self.N0 = 2**self.LV
        self.tree = [self.default]*(2*self.N0)
        self.lazy = [None]*(2*self.N0)

    #伝搬対象の区間を求める
    def gindex(self, l, r):
        L = (l + self.N0) >> 1; R = (r + self.N0) >> 1
        lc = 0 if l & 1 else (L & -L).bit_length()
        rc = 0 if r & 1 else (R & -R).bit_length()
        for i in range(self.LV):
            if rc <= i:
                yield R
            if L < R and lc <= i:
                yield L
            L >>= 1; R >>= 1

    #遅延伝搬処理
    def propagates(self,*ids):
        for i in reversed(ids):
            v = self.lazy[i-1]
            if v is None:
                continue
            self.lazy[2*i-1] = self.tree[2*i-1] = self.lazy[2*i] = self.tree[2*i] = v
            self.lazy[i-1] = None

    #区間[l,r)の値をxに更新
    def update(self,l,r,x):
        if l < r:
            *ids, = self.gindex(l, r)
            self.propagates(*ids)

            L = l + self.N0; R = r + self.N0
            while L < R:
                if R & 1:
                    R -= 1
                    self.lazy[R-1] = self.tree[R-1] = x
                if L & 1:
                    self.lazy[L-1] = self.tree[L-1] = x
                    L += 1
                L >>= 1; R >>= 1

            for i in ids:
                self.tree[i-1] = self.op(self.tree[2*i-1], self.tree[2*i])

    #区間[l,r)へのクエリ
    def query(self,l,r):
        self.propagates(*self.gindex(l, r))
        L = l + self.N0; R = r + self.N0
        s = self.default
        while L < R:
            if R & 1:
                R -= 1
                s = self.op(s,self.tree[R-1])
            if L & 1:
                s = self.op(s,self.tree[L-1])
                L += 1
            L >>= 1; R >>= 1
        return s

    #1-indexedでk番目の値を取得
    def get(self,k):
        self.propagates(*self.gindex(k, k+1))
        return self.tree[k+self.N0-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 = LazySegmentTree(Q, 10**9+1)
for b in a:
    l = bisect_left(D,b[1]) + 1
    r = bisect_left(D,b[2]) + 1
    seg.update(l,r,b[0])

for i in range(Q):
    x = seg.get(i+1)
    if x == 10**9+1:
        print(-1)
    else:
        print(x)

### FIXED CODE ###

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(map(int, input().split())) for _ in range(N)]
        return map(list,zip(*read_all))

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

from operator import itemgetter
from bisect import bisect_left

N,Q = II()
a = []
for _ in range(N):
    s,t,x = II()
    a.append((x, s-x-0.5, t-x-0.5))
a.sort(key=itemgetter(0))
D = Line(Q,1)

ans = [-1]*(Q+1)
right = [0]*Q
for a0 in a:
    l = bisect_left(D,a0[1])
    r = bisect_left(D,a0[2])
    while l<r:
        while ans[l]!=-1:
            l = right[l]
            if l==N:
                break
        if l>=r:
            break
        ans[l] = a0[0]
        right[l] = r
        l += 1

for i in range(Q):
    print(ans[i])