import sys
import bisect


class DualSegmentTree():

    def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

    def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

    def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val

n, q = map(int, input().split())
info = [list(map(int, sys.stdin.readline().split())) for i in range(n)]
d = [int(sys.stdin.readline()) for i in range(q)]
INF = float("inf")

st = DualSegmentTree(len(d)+1)

for i in range(n):
    a, b = info[i][0] - info[i][2], info[i][1] - info[i][2]  
    l = bisect.bisect_left(d, a)
    r = bisect.bisect_left(d, b)
    st.update(l, r, info[i][2])

for i in range(q):
    tmp = st.get_val(i)
    if tmp == float("inf"):
        print(-1)
    else:
        print(tmp) import sys sys import bisect bisect class DualSegmentTree():

    def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

    def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

    def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val DualSegmentTree def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

     __init__ INF = float("inf") INF float("inf") float "inf" self.size = 1 self.size self size 1 while self.size < n:
            self.size *= 2
         self.size < n self.size self size n self.size *= 2 self.size self size 2 self.node = [INF] * (2*self.size - 1) self.node self node [INF] * (2*self.size - 1) [INF] INF 2*self.size - 1 2*self.size 2 self.size self size 1 self self n n def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

     update begin += (self.size - 1) begin self.size - 1 self.size self size 1 end += (self.size - 1) end self.size - 1 self.size self size 1 while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

     begin < end begin end if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
             (end - 1) & 1 end - 1 end 1 1 end -= 1 end 1 self.node[end] = min(val, self.node[end]) self.node[end] self.node self node end min(val, self.node[end]) min val self.node[end] self.node self node end if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
             (begin - 1) & 1 begin - 1 begin 1 1 self.node[begin] = min(val, self.node[begin]) self.node[begin] self.node self node begin min(val, self.node[begin]) min val self.node[begin] self.node self node begin begin += 1 begin 1 begin = (begin - 1) // 2 begin (begin - 1) // 2 begin - 1 begin 1 2 end = (end - 1) // 2 end (end - 1) // 2 end - 1 end 1 2 self self begin begin end end val val def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val get_val i += (self.size - 1) i self.size - 1 self.size self size 1 val = self.node[i] val self.node[i] self.node self node i while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
         i > 0 i 0 i = (i - 1) // 2 i (i - 1) // 2 i - 1 i 1 2 val = min(val, self.node[i]) val min(val, self.node[i]) min val self.node[i] self.node self node i return val val self self i i n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q list(map(int, sys.stdin.readline().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split info = [list(map(int, sys.stdin.readline().split())) for i in range(n)] info [list(map(int, sys.stdin.readline().split())) for i in range(n)] int(sys.stdin.readline()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline d = [int(sys.stdin.readline()) for i in range(q)] d [int(sys.stdin.readline()) for i in range(q)] INF = float("inf") INF float("inf") float "inf" st = DualSegmentTree(len(d)+1) st DualSegmentTree(len(d)+1) DualSegmentTree len(d)+1 len(d) len d 1 for i in range(n):
    a, b = info[i][0] - info[i][2], info[i][1] - info[i][2]  
    l = bisect.bisect_left(d, a)
    r = bisect.bisect_left(d, b)
    st.update(l, r, info[i][2]) i range(n) range n a, b = info[i][0] - info[i][2], info[i][1] - info[i][2] a info[i][0] - info[i][2] info[i][0] [i] info i 0 info[i][2] [i] info i 2 b info[i][1] - info[i][2] info[i][1] [i] info i 1 info[i][2] [i] info i 2 l = bisect.bisect_left(d, a) l bisect.bisect_left(d, a) bisect.bisect_left bisect bisect_left d a r = bisect.bisect_left(d, b) r bisect.bisect_left(d, b) bisect.bisect_left bisect bisect_left d b st.update(l, r, info[i][2]) st.update st update l r info[i][2] [i] info i 2 for i in range(q):
    tmp = st.get_val(i)
    if tmp == float("inf"):
        print(-1)
    else:
        print(tmp) i range(q) range q tmp = st.get_val(i) tmp st.get_val(i) st.get_val st get_val i if tmp == float("inf"):
        print(-1)
    else:
        print(tmp) tmp == float("inf") tmp float("inf") float "inf" print(-1) print -1 print(tmp) print tmp info = [list(map(int, sys.stdin.readline().split())) for i in range(n)] [list(map(int, sys.stdin.readline().split())) for i in range(n)] info a, b = info[i][0] - info[i][2], info[i][1] - info[i][2] info[i][0] - info[i][2] a tmp = st.get_val(i) st.get_val(i) tmp q = map(int, input().split()) map(int, input().split()) q b = info[i][0] - info[i][2], info[i][1] - info[i][2] info[i][1] - info[i][2] b r = bisect.bisect_left(d, b) bisect.bisect_left(d, b) r INF = float("inf") float("inf") INF n, q = map(int, input().split()) map(int, input().split()) n class DualSegmentTree():

    def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

    def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

    def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val class DualSegmentTree():

    def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

    def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

    def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val DualSegmentTree d = [int(sys.stdin.readline()) for i in range(q)] [int(sys.stdin.readline()) for i in range(q)] d l = bisect.bisect_left(d, a) bisect.bisect_left(d, a) l st = DualSegmentTree(len(d)+1) DualSegmentTree(len(d)+1) st
import sys
import bisect


class DualSegmentTree():

    def __init__(self, n):
        INF = float("inf")
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [INF] * (2*self.size - 1)

    def update(self, begin, end, val):
        begin += (self.size - 1)
        end += (self.size - 1)
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                self.node[end] = min(val, self.node[end])
            if (begin - 1) & 1:
                self.node[begin] = min(val, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2

    def get_val(self, i):
        i += (self.size - 1)
        val = self.node[i]
        while i > 0:
            i = (i - 1) // 2
            val = min(val, self.node[i])
        return val

n, q = map(int, input().split())
info = [list(map(int, sys.stdin.readline().split())) for i in range(n)]
d = [int(sys.stdin.readline()) for i in range(q)]
INF = float("inf")

st = DualSegmentTree(len(d)+1)

for i in range(n):
    a, b = info[i][0] - info[i][2], info[i][1] - info[i][2]  
    l = bisect.bisect_left(d, a)
    r = bisect.bisect_left(d, b)
    st.update(l, r, info[i][2])

for i in range(q):
    tmp = st.get_val(i)
    if tmp == float("inf"):
        print(-1)
    else:
        print(tmp)
