import sys

input = sys.stdin.readline

from heapq import *

N, Q = list(map(int, input().split()))

X = []

for _ in range(N):

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

    X.append((s-x,t-x,x))



X = sorted(X, key = lambda x: x[0])

i = 0

A, B, C = [], [], []

for _ in range(Q):

    d = int(eval(input()))

    while i < len(X) and d >= X[i][0]:

        a, b, x = X[i]

        heappush(A, (x, b))

        heappush(B, (b, x))

        i += 1

    while len(B) and B[0][0] <= d:

        b, x = heappop(B)

        heappush(C, (x, b))

    while len(C) and len(A) and C[0][0] == A[0][0]:

        heappop(A)

        heappop(C)

    print((A[0][0] if A else -1))

import sys

input = sys.stdin.readline

from bisect import bisect_left as bl

class segtree:

    def __init__(self, nn):

        self.NN = nn

        self.XX = [0] * (2**(nn+1)-1)

    def getmax(self, i):

        j = 2**self.NN + i - 1

        ma = -1

        while j >= 0:

            ma = max(ma, self.XX[j])

            j = (j-1) // 2

        return -1 if ma <= 0 else INF - ma

    def updaterange(self, a, b, x):

        l = a + (1<<self.NN)

        r = b + (1<<self.NN)

        s = 0

        while l < r:

            if l%2:

                self.XX[l-1] = max(self.XX[l-1], x)

                l += 1

            if r%2:

                r -= 1

                self.XX[r-1] = max(self.XX[r-1], x)

            l >>= 1

            r >>= 1



N, Q = list(map(int, input().split()))

st = segtree(18)

INF = 1<<50

X = []

D = []

for _ in range(N):

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

    X.append((s, t, x))

for _ in range(Q):

    D.append(int(eval(input())))



for s, t, x in X:

    st.updaterange(bl(D, s-x), bl(D, t-x), INF-x)

for i in range(Q):

    print((st.getmax(i)))

import sys

input = sys.stdin.readline
from heapq import *

N, Q = list(map(int, input().split()))
X = []
for _ in range(N):
    s, t, x = list(map(int, input().split()))
    X.append((s - x, t - x, x))
X = sorted(X, key=lambda x: x[0])
i = 0
A, B, C = [], [], []
for _ in range(Q):
    d = int(eval(input()))
    while i < len(X) and d >= X[i][0]:
        a, b, x = X[i]
        heappush(A, (x, b))
        heappush(B, (b, x))
        i += 1
    while len(B) and B[0][0] <= d:
        b, x = heappop(B)
        heappush(C, (x, b))
    while len(C) and len(A) and C[0][0] == A[0][0]:
        heappop(A)
        heappop(C)
    print((A[0][0] if A else -1))

import sys

input = sys.stdin.readline
from bisect import bisect_left as bl


class segtree:
    def __init__(self, nn):
        self.NN = nn
        self.XX = [0] * (2 ** (nn + 1) - 1)

    def getmax(self, i):
        j = 2**self.NN + i - 1
        ma = -1
        while j >= 0:
            ma = max(ma, self.XX[j])
            j = (j - 1) // 2
        return -1 if ma <= 0 else INF - ma

    def updaterange(self, a, b, x):
        l = a + (1 << self.NN)
        r = b + (1 << self.NN)
        s = 0
        while l < r:
            if l % 2:
                self.XX[l - 1] = max(self.XX[l - 1], x)
                l += 1
            if r % 2:
                r -= 1
                self.XX[r - 1] = max(self.XX[r - 1], x)
            l >>= 1
            r >>= 1


N, Q = list(map(int, input().split()))
st = segtree(18)
INF = 1 << 50
X = []
D = []
for _ in range(N):
    s, t, x = list(map(int, input().split()))
    X.append((s, t, x))
for _ in range(Q):
    D.append(int(eval(input())))
for s, t, x in X:
    st.updaterange(bl(D, s - x), bl(D, t - x), INF - x)
for i in range(Q):
    print((st.getmax(i)))

-from heapq import * +from bisect import bisect_left as bl + + +class segtree: +    def __init__(self, nn): +        self.NN = nn +        self.XX = [0] * (2 ** (nn + 1) - 1) + +    def getmax(self, i): +        j = 2**self.NN + i - 1 +        ma = -1 +        while j >= 0: +            ma = max(ma, self.XX[j]) +            j = (j - 1) // 2 +        return -1 if ma <= 0 else INF - ma + +    def updaterange(self, a, b, x): +        l = a + (1 << self.NN) +        r = b + (1 << self.NN) +        s = 0 +        while l < r: +            if l % 2: +                self.XX[l - 1] = max(self.XX[l - 1], x) +                l += 1 +            if r % 2: +                r -= 1 +                self.XX[r - 1] = max(self.XX[r - 1], x) +            l >>= 1 +            r >>= 1 + +st = segtree(18) +INF = 1 << 50 +D = [] -    X.append((s - x, t - x, x)) -X = sorted(X, key=lambda x: x[0]) -i = 0 -A, B, C = [], [], [] +    X.append((s, t, x)) -    d = int(eval(input())) -    while i < len(X) and d >= X[i][0]: -        a, b, x = X[i] -        heappush(A, (x, b)) -        heappush(B, (b, x)) -        i += 1 -    while len(B) and B[0][0] <= d: -        b, x = heappop(B) -        heappush(C, (x, b)) -    while len(C) and len(A) and C[0][0] == A[0][0]: -        heappop(A) -        heappop(C) -    print((A[0][0] if A else -1)) +    D.append(int(eval(input()))) +for s, t, x in X: +    st.updaterange(bl(D, s - x), bl(D, t - x), INF - x) +for i in range(Q): +    print((st.getmax(i)))