def main():

    import sys

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



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



    N = q

    N0 = 2**(N-1).bit_length()

    data = [None]*(2*N0)

    INF = (-1, 10**9 + 1)

    def update(l, r, v):

        L = l + N0; R = r + N0

        while L < R:

            if R & 1:

                R -= 1

                data[R-1] = v



            if L & 1:

                data[L-1] = v

                L += 1

            L >>= 1; R >>= 1

    def _query(k):

        k += N0-1

        s = INF

        while k >= 0:

            if data[k]:

                s = max(s, data[k])

            k = (k - 1) // 2

        return s

    def query(k):

        return _query(k)[1]







    import bisect



    for i, (x, start, last) in enumerate(stx):

        l = bisect.bisect_left(d, start)

        r = bisect.bisect_left(d, last)

        update(l, r, (i, x))



    for i in range(q):

        res = query(i)

        if res == 10**9 + 1:

            print((-1))

        else:

            print(res)

if __name__ == '__main__':

    main()

    



import sys

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



def segfun(x, y):

    return min(x, y)

ide_ele = float("inf")





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, ide_ele, segfun)



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 == float("inf"):

        print((-1))

    else:

        print(res)

    



def main():
    import sys

    input = lambda: sys.stdin.readline().rstrip()
    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)]
    N = q
    N0 = 2 ** (N - 1).bit_length()
    data = [None] * (2 * N0)
    INF = (-1, 10**9 + 1)

    def update(l, r, v):
        L = l + N0
        R = r + N0
        while L < R:
            if R & 1:
                R -= 1
                data[R - 1] = v
            if L & 1:
                data[L - 1] = v
                L += 1
            L >>= 1
            R >>= 1

    def _query(k):
        k += N0 - 1
        s = INF
        while k >= 0:
            if data[k]:
                s = max(s, data[k])
            k = (k - 1) // 2
        return s

    def query(k):
        return _query(k)[1]

    import bisect

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


if __name__ == "__main__":
    main()

import sys

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


def segfun(x, y):
    return min(x, y)


ide_ele = float("inf")


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, ide_ele, segfun)
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 == float("inf"):
        print((-1))
    else:
        print(res)

-def main(): -    import sys +import sys -    input = lambda: sys.stdin.readline().rstrip() -    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)] -    N = q -    N0 = 2 ** (N - 1).bit_length() -    data = [None] * (2 * N0) -    INF = (-1, 10**9 + 1) - -    def update(l, r, v): -        L = l + N0 -        R = r + N0 -        while L < R: -            if R & 1: -                R -= 1 -                data[R - 1] = v -            if L & 1: -                data[L - 1] = v -                L += 1 -            L >>= 1 -            R >>= 1 - -    def _query(k): -        k += N0 - 1 -        s = INF -        while k >= 0: -            if data[k]: -                s = max(s, data[k]) -            k = (k - 1) // 2 -        return s - -    def query(k): -        return _query(k)[1] - -    import bisect - -    for i, (x, start, last) in enumerate(stx): -        l = bisect.bisect_left(d, start) -        r = bisect.bisect_left(d, last) -        update(l, r, (i, x)) -    for i in range(q): -        res = query(i) -        if res == 10**9 + 1: -            print((-1)) -        else: -            print(res) +input = lambda: sys.stdin.readline().rstrip() -if __name__ == "__main__": -    main() +def segfun(x, y): +    return min(x, y) + + +ide_ele = float("inf") + + +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, ide_ele, segfun) +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 == float("inf"): +        print((-1)) +    else: +        print(res)