import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
INF = float('inf')

class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1]

N, Q = map(int, input().split())
stx = [[int(x) for x in input().split()] for i in range(N)]
stx.sort(key = lambda v : -v[2])
D = [(int(input()), i) for i in range(Q)]
D.sort(key = lambda v : v[0])
d, p = [d for d, p in D], [p for d, p in D]
seg = SegmentTree(Q)
for i, (s, t, x) in enumerate(stx):
    l = bisect_left(d, s-x)
    r = bisect_left(d, t-x)
    seg.Update(l, r, i, x)
ans = [None] * Q
for i in range(Q):
    tmp = seg.getValue(i)
    if tmp == INF:
        tmp = -1
    ans[p[i]] = tmp
print(*ans, sep = '\n') import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 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 from bisect import * from collections import * from heapq import * from math import * from itertools import * INF = float('inf') INF float('inf') float 'inf' class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1] SegmentTree def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

     __init__ self.N = 1<<(N-1).bit_length() self.N self N 1<<(N-1).bit_length() 1 (N-1).bit_length() N-1).bit_length N-1 N 1 bit_length self.data = [None] * (2*self.N) self.data self data [None] * (2*self.N) [None] None 2*self.N 2 self.N self N self self N N def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

     Update L, R, val = l+self.N, r+self.N, (t, v) L l+self.N l self.N self N R r+self.N r self.N self N val (t, v) t v while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

     L < R L R if R & 1:
                R -= 1
                self.data[R-1] = val
             R & 1 R 1 R -= 1 R 1 self.data[R-1] = val self.data[R-1] self.data self data R-1 R 1 val if L & 1:
                self.data[L-1] = val
                L += 1
             L & 1 L 1 self.data[L-1] = val self.data[L-1] self.data self data L-1 L 1 val L += 1 L 1 L >>= 1 L 1 R >>= 1 R 1 self self l l r r t t v v def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1] getValue x += self.N-1 x self.N-1 self.N self N 1 ret = (-1, INF) ret (-1, INF) -1 INF while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
         x >= 0 x 0 if self.data[x]:
                ret = max(ret, self.data[x])
             self.data[x] self.data self data x ret = max(ret, self.data[x]) ret max(ret, self.data[x]) max ret self.data[x] self.data self data x x = (x-1)//2 x (x-1)//2 x-1 x 1 2 return ret[1] ret[1] ret 1 self self x x N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q [int(x) for x in input().split()] for i in range(N) for i in range(N) i range(N) range N for i in range(N) [int(x) for x in input().split()] stx = [[int(x) for x in input().split()] for i in range(N)] stx [[int(x) for x in input().split()] for i in range(N)] stx.sort(key = lambda v : -v[2]) stx.sort stx sort key = lambda v : -v[2] key lambda v : -v[2] -v[2] v[2] v 2 v (int(input()), i) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) (int(input()), i) int(input()) int input() input i D = [(int(input()), i) for i in range(Q)] D [(int(input()), i) for i in range(Q)] D.sort(key = lambda v : v[0]) D.sort D sort key = lambda v : v[0] key lambda v : v[0] v[0] v 0 v d for d, p in D for d, p in D d p D for d, p in D d d, p = [d for d, p in D], [p for d, p in D] d [d for d, p in D] p [p for d, p in D] seg = SegmentTree(Q) seg SegmentTree(Q) SegmentTree Q for i, (s, t, x) in enumerate(stx):
    l = bisect_left(d, s-x)
    r = bisect_left(d, t-x)
    seg.Update(l, r, i, x) i (s, t, x) s t x enumerate(stx) enumerate stx l = bisect_left(d, s-x) l bisect_left(d, s-x) bisect_left d s-x s x r = bisect_left(d, t-x) r bisect_left(d, t-x) bisect_left d t-x t x seg.Update(l, r, i, x) seg.Update seg Update l r i x ans = [None] * Q ans [None] * Q [None] None Q for i in range(Q):
    tmp = seg.getValue(i)
    if tmp == INF:
        tmp = -1
    ans[p[i]] = tmp i range(Q) range Q tmp = seg.getValue(i) tmp seg.getValue(i) seg.getValue seg getValue i if tmp == INF:
        tmp = -1
     tmp == INF tmp INF tmp = -1 tmp -1 ans[p[i]] = tmp ans[p[i]] ans p[i] p i tmp print(*ans, sep = '\n') print *ans ans sep = '\n' sep '\n' r = bisect_left(d, t-x) bisect_left(d, t-x) r def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input p = [d for d, p in D], [p for d, p in D] [p for d, p in D] p l = bisect_left(d, s-x) bisect_left(d, s-x) l tmp = seg.getValue(i) seg.getValue(i) tmp tmp = -1 -1 tmp seg = SegmentTree(Q) SegmentTree(Q) seg INF = float('inf') float('inf') INF d, p = [d for d, p in D], [p for d, p in D] [d for d, p in D] d Q = map(int, input().split()) map(int, input().split()) Q ans = [None] * Q [None] * Q ans D = [(int(input()), i) for i in range(Q)] [(int(input()), i) for i in range(Q)] D N, Q = map(int, input().split()) map(int, input().split()) N class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1] class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1] SegmentTree stx = [[int(x) for x in input().split()] for i in range(N)] [[int(x) for x in input().split()] for i in range(N)] stx
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
INF = float('inf')

class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1]

N, Q = map(int, input().split())
stx = [[int(x) for x in input().split()] for i in range(N)]
stx.sort(key = lambda v : -v[2])
D = [(int(input()), i) for i in range(Q)]
D.sort(key = lambda v : v[0])
d, p = [d for d, p in D], [p for d, p in D]
seg = SegmentTree(Q)
for i, (s, t, x) in enumerate(stx):
    l = bisect_left(d, s-x)
    r = bisect_left(d, t-x)
    seg.Update(l, r, i, x)
ans = [None] * Q
for i in range(Q):
    tmp = seg.getValue(i)
    if tmp == INF:
        tmp = -1
    ans[p[i]] = tmp
print(*ans, sep = '\n')
