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]) 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(map(int, input().split())) 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(map(int, input().split())) 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(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split read_all = [tuple(map(int, input().split())) for _ in range(N)] read_all [tuple(map(int, input().split())) 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 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 a.sort(key=itemgetter(0)) a.sort a sort key=itemgetter(0) key itemgetter(0) itemgetter 0 D = Line(Q,1) D Line(Q,1) Line Q 1 ans = [-1]*(Q+1) ans [-1]*(Q+1) [-1] -1 Q+1 Q 1 right = [0]*Q right [0]*Q [0] 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 a0 a l = bisect_left(D,a0[1]) l bisect_left(D,a0[1]) bisect_left D a0[1] a0 1 r = bisect_left(D,a0[2]) r bisect_left(D,a0[2]) bisect_left D a0[2] 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 l<r l r while ans[l]!=-1:
            l = right[l]
            if l==N:
                break
         ans[l]!=-1 ans[l] ans l -1 l = right[l] l right[l] right l if l==N:
                break
         l==N l N break if l>=r:
            break
         l>=r l r break ans[l] = a0[0] ans[l] ans l a0[0] a0 0 right[l] = r right[l] right l r l += 1 l 1 for i in range(Q):
    print(ans[i]) i range(Q) range Q print(ans[i]) print ans[i] ans i mod = 10**9 + 7 10**9 + 7 mod 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))

################# 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))

################# Line s,t,x = II() II() s r = bisect_left(D,a0[2]) bisect_left(D,a0[2]) r N,Q = II() II() N def I(): return int(input()) def I(): return int(input()) I x = II() II() x ans = [-1]*(Q+1) [-1]*(Q+1) ans def III(): return list(map(int, input().split())) def III(): return list(map(int, input().split())) III l = right[l] right[l] l right = [0]*Q [0]*Q right t,x = II() II() t Q = II() II() Q def II(): return map(int, input().split()) def II(): return map(int, input().split()) II a = [] [] a D = Line(Q,1) Line(Q,1) D l = bisect_left(D,a0[1]) bisect_left(D,a0[1]) l l += 1 1 l def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input
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])