import sys

input = lambda : sys.stdin.readline().rstrip()



class SegmentTree:

    def __init__(self, n, ele, segfun):

        self.ide_ele = ele

        self.segfun = segfun

        self.n = n

        self.N0 = 1 << n.bit_length()

        self.data = [self.ide_ele] * (self.N0 * 2)

 

    def update(self, l, r, val):

        l += self.N0

        r += self.N0

        while l < r:

            if l & 1:

                self.data[l] = self.segfun(self.data[l], val)

                l += 1

            if r & 1:

                self.data[r - 1] = self.segfun(self.data[r - 1], val)

                r -= 1

            l //= 2

            r //= 2

 

    def query(self, i):

        i += len(self.data) // 2

        ret = self.data[i]

        while i > 0:

            i //= 2

            ret = self.segfun(ret, self.data[i])

        return ret



n, q = list(map(int, input().split()))

stx = []

for _ in range(n):

    s, t, x = list(map(int, input().split()))

    stx.append([x, s - x, t - x])

stx.sort(reverse=True)

d = [int(eval(input())) for _ in range(q)]



import bisect



seg = SegmentTree(q, 10**9 + 1, lambda a, b : min(a, b))



for x, start, last in stx:

    l = bisect.bisect_left(d, start)

    r = bisect.bisect_left(d, last)

    seg.update(l, r, x)



for i, j in enumerate(d):

    res = seg.query(i)

    if res == 10**9 + 1:

        print((-1))

    else:

        print(res)

    



import sys

input = lambda : sys.stdin.readline().rstrip()



class SegmentTree:

    def __init__(self, n, ele, segfun):

        self.ide_ele = ele

        self.segfun = segfun

        self.n = n

        self.N0 = 1 << n.bit_length()

        self.data = [self.ide_ele] * (self.N0 * 2)

 

    def update(self, l, r, val):

        l += self.N0

        r += self.N0

        while l < r:

            if l & 1:

                self.data[l] = self.segfun(self.data[l], val)

                l += 1

            if r & 1:

                self.data[r - 1] = self.segfun(self.data[r - 1], val)

                r -= 1

            l //= 2

            r //= 2

 

    def query(self, i):

        i += len(self.data) // 2

        ret = self.data[i]

        while i > 0:

            i //= 2

            ret = self.segfun(ret, self.data[i])

        return ret



n, q = list(map(int, input().split()))

stx = []

for _ in range(n):

    s, t, x = list(map(int, input().split()))

    stx.append([x, s - x, t - x])

# stx.sort(reverse=True)

d = [int(eval(input())) for _ in range(q)]



import bisect



seg = SegmentTree(q, 10**9 + 1, lambda a, b : min(a, b))



for x, start, last in stx:

    l = bisect.bisect_left(d, start)

    r = bisect.bisect_left(d, last)

    seg.update(l, r, x)



for i, j in enumerate(d):

    res = seg.query(i)

    if res == 10**9 + 1:

        print((-1))

    else:

        print(res)

    



import sys

input = lambda: sys.stdin.readline().rstrip()


class SegmentTree:
    def __init__(self, n, ele, segfun):
        self.ide_ele = ele
        self.segfun = segfun
        self.n = n
        self.N0 = 1 << n.bit_length()
        self.data = [self.ide_ele] * (self.N0 * 2)

    def update(self, l, r, val):
        l += self.N0
        r += self.N0
        while l < r:
            if l & 1:
                self.data[l] = self.segfun(self.data[l], val)
                l += 1
            if r & 1:
                self.data[r - 1] = self.segfun(self.data[r - 1], val)
                r -= 1
            l //= 2
            r //= 2

    def query(self, i):
        i += len(self.data) // 2
        ret = self.data[i]
        while i > 0:
            i //= 2
            ret = self.segfun(ret, self.data[i])
        return ret


n, q = list(map(int, input().split()))
stx = []
for _ in range(n):
    s, t, x = list(map(int, input().split()))
    stx.append([x, s - x, t - x])
stx.sort(reverse=True)
d = [int(eval(input())) for _ in range(q)]
import bisect

seg = SegmentTree(q, 10**9 + 1, lambda a, b: min(a, b))
for x, start, last in stx:
    l = bisect.bisect_left(d, start)
    r = bisect.bisect_left(d, last)
    seg.update(l, r, x)
for i, j in enumerate(d):
    res = seg.query(i)
    if res == 10**9 + 1:
        print((-1))
    else:
        print(res)

import sys

input = lambda: sys.stdin.readline().rstrip()


class SegmentTree:
    def __init__(self, n, ele, segfun):
        self.ide_ele = ele
        self.segfun = segfun
        self.n = n
        self.N0 = 1 << n.bit_length()
        self.data = [self.ide_ele] * (self.N0 * 2)

    def update(self, l, r, val):
        l += self.N0
        r += self.N0
        while l < r:
            if l & 1:
                self.data[l] = self.segfun(self.data[l], val)
                l += 1
            if r & 1:
                self.data[r - 1] = self.segfun(self.data[r - 1], val)
                r -= 1
            l //= 2
            r //= 2

    def query(self, i):
        i += len(self.data) // 2
        ret = self.data[i]
        while i > 0:
            i //= 2
            ret = self.segfun(ret, self.data[i])
        return ret


n, q = list(map(int, input().split()))
stx = []
for _ in range(n):
    s, t, x = list(map(int, input().split()))
    stx.append([x, s - x, t - x])
# stx.sort(reverse=True)
d = [int(eval(input())) for _ in range(q)]
import bisect

seg = SegmentTree(q, 10**9 + 1, lambda a, b: min(a, b))
for x, start, last in stx:
    l = bisect.bisect_left(d, start)
    r = bisect.bisect_left(d, last)
    seg.update(l, r, x)
for i, j in enumerate(d):
    res = seg.query(i)
    if res == 10**9 + 1:
        print((-1))
    else:
        print(res)

-stx.sort(reverse=True) +# stx.sort(reverse=True)