import sys
input = sys.stdin.readline
# Segment Tree
# segfunc : min, +, *, xor, gcd など
# identity_element : 単位元(min:inf, 和:0, 積:1, xor:0, gcd:0)


class Segment:
    def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def segfunc(self, x, y):
        return min(x, y)  # 変える


def compress(arr):
    *XS, = set(arr)
    XS.sort()
    return {e: i for i, e in enumerate(XS)}


n, q = map(int, input().split())
s, t, x = [0] * n, [0] * n, [0] * n
for i in range(n):
    s[i], t[i], x[i] = map(int, input().split())
    s[i] -= x[i]
    t[i] -= x[i]
    s[i] = max(s[i], 0)
    t[i] = max(t[i], 0)

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

com = compress(s + t + d)
k = len(com) + 1

for i in range(n):
    s[i] = com[s[i]]
    t[i] = com[t[i]]

for i in range(q):
    d[i] = com[d[i]]
INF = 1 << 30
a = [INF] * k
b = [[] for i in range(k)]
c = [[] for i in range(k)]
seg = Segment(n, [INF] * n)
for i in range(n):
    b[s[i]].append(i)
    c[t[i]].append(i)

for i in range(k):
    for j in b[i]:
        seg.update(j, x[j])
    for j in c[i]:
        seg.update(j, INF)
    a[i] = seg.query(0, n)

for i in d:
    print(-1 if a[i] == INF else a[i]) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline class Segment:
    def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def segfunc(self, x, y):
        return min(x, y)  # 変える Segment def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
     __init__ """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """ self.identity_element = 2 ** 31 - 1 self.identity_element self identity_element 2 ** 31 - 1 2 ** 31 2 31 1 self.N0 = 1 << (N - 1).bit_length() self.N0 self N0 1 << (N - 1).bit_length() 1 (N - 1).bit_length() N - 1).bit_length N - 1 N 1 bit_length self.dat = [self.identity_element] * (2 * self.N0) self.dat self dat [self.identity_element] * (2 * self.N0) [self.identity_element] self.identity_element self identity_element 2 * self.N0 2 self.N0 self N0 for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
         i range(N) range N self.dat[i + self.N0 - 1] = init_val[i] self.dat[i + self.N0 - 1] self.dat self dat i + self.N0 - 1 i + self.N0 i self.N0 self N0 1 init_val[i] init_val i for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
     i range(self.N0 - 2, -1, -1) range self.N0 - 2 self.N0 self N0 2 -1 -1 self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2]) self.dat[i] self.dat self dat i self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2]) self.segfunc self segfunc self.dat[2 * i + 1] self.dat self dat 2 * i + 1 2 * i 2 i 1 self.dat[2 * i + 2] self.dat self dat 2 * i + 2 2 * i 2 i 2 self self N N init_val init_val def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
     update k += self.N0 - 1 k self.N0 - 1 self.N0 self N0 1 self.dat[k] = x self.dat[k] self.dat self dat k x while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
     k >= 0 k 0 k = (k - 1) // 2 k (k - 1) // 2 k - 1 k 1 2 self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2]) self.dat[k] self.dat self dat k self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2]) self.segfunc self segfunc self.dat[2 * k + 1] self.dat self dat 2 * k + 1 2 * k 2 k 1 self.dat[2 * k + 2] self.dat self dat 2 * k + 2 2 * k 2 k 2 self self k k x x def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

     query L = l + self.N0 L l + self.N0 l self.N0 self N0 R = r + self.N0 R r + self.N0 r self.N0 self N0 s = self.identity_element s self.identity_element self identity_element while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
         L < R L R if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
             R & 1 R 1 R -= 1 R 1 s = self.segfunc(s, self.dat[R - 1]) s self.segfunc(s, self.dat[R - 1]) self.segfunc self segfunc s self.dat[R - 1] self.dat self dat R - 1 R 1 if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
             L & 1 L 1 s = self.segfunc(s, self.dat[L - 1]) s self.segfunc(s, self.dat[L - 1]) self.segfunc self segfunc s self.dat[L - 1] self.dat self dat L - 1 L 1 L += 1 L 1 L >>= 1 L 1 R >>= 1 R 1 return s s self self l l r r def segfunc(self, x, y):
        return min(x, y)  # 変える segfunc return min(x, y) min(x, y) min x y self self x x y y def compress(arr):
    *XS, = set(arr)
    XS.sort()
    return {e: i for i, e in enumerate(XS)} compress *XS, = set(arr) *XS XS set(arr) set arr XS.sort() XS.sort XS sort e: i for i, e in enumerate(XS) for i, e in enumerate(XS) i e enumerate(XS) enumerate XS for i, e in enumerate(XS) e i return {e: i for i, e in enumerate(XS)} {e: i for i, e in enumerate(XS)} arr arr n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q s, t, x = [0] * n, [0] * n, [0] * n s [0] * n [0] 0 n t [0] * n [0] 0 n x [0] * n [0] 0 n for i in range(n):
    s[i], t[i], x[i] = map(int, input().split())
    s[i] -= x[i]
    t[i] -= x[i]
    s[i] = max(s[i], 0)
    t[i] = max(t[i], 0) i range(n) range n s[i], t[i], x[i] = map(int, input().split()) s[i] s i map(int, input().split()) map int input().split() ().split () input split t[i] t i x[i] x i s[i] -= x[i] s[i] s i x[i] x i t[i] -= x[i] t[i] t i x[i] x i s[i] = max(s[i], 0) s[i] s i max(s[i], 0) max s[i] s i 0 t[i] = max(t[i], 0) t[i] t i max(t[i], 0) max t[i] t i 0 int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input d = [int(input()) for i in range(q)] d [int(input()) for i in range(q)] com = compress(s + t + d) com compress(s + t + d) compress s + t + d s + t s t d k = len(com) + 1 k len(com) + 1 len(com) len com 1 for i in range(n):
    s[i] = com[s[i]]
    t[i] = com[t[i]] i range(n) range n s[i] = com[s[i]] s[i] s i com[s[i]] com s[i] s i t[i] = com[t[i]] t[i] t i com[t[i]] com t[i] t i for i in range(q):
    d[i] = com[d[i]] i range(q) range q d[i] = com[d[i]] d[i] d i com[d[i]] com d[i] d i INF = 1 << 30 INF 1 << 30 1 30 a = [INF] * k a [INF] * k [INF] INF k [] for i in range(k) for i in range(k) i range(k) range k for i in range(k) [] b = [[] for i in range(k)] b [[] for i in range(k)] [] for i in range(k) for i in range(k) i range(k) range k for i in range(k) [] c = [[] for i in range(k)] c [[] for i in range(k)] seg = Segment(n, [INF] * n) seg Segment(n, [INF] * n) Segment n [INF] * n [INF] INF n for i in range(n):
    b[s[i]].append(i)
    c[t[i]].append(i) i range(n) range n b[s[i]].append(i) [s[i]].append [s[i]] b s[i] s i append i c[t[i]].append(i) [t[i]].append [t[i]] c t[i] t i append i for i in range(k):
    for j in b[i]:
        seg.update(j, x[j])
    for j in c[i]:
        seg.update(j, INF)
    a[i] = seg.query(0, n) i range(k) range k for j in b[i]:
        seg.update(j, x[j])
     j b[i] b i seg.update(j, x[j]) seg.update seg update j x[j] x j for j in c[i]:
        seg.update(j, INF)
     j c[i] c i seg.update(j, INF) seg.update seg update j INF a[i] = seg.query(0, n) a[i] a i seg.query(0, n) seg.query seg query 0 n for i in d:
    print(-1 if a[i] == INF else a[i]) i d print(-1 if a[i] == INF else a[i]) print -1 if a[i] == INF else a[i] a[i] == INF a[i] a i INF -1 a[i] a i s, t, x = [0] * n, [0] * n, [0] * n [0] * n s com = compress(s + t + d) compress(s + t + d) com n, q = map(int, input().split()) map(int, input().split()) n x = [0] * n, [0] * n, [0] * n [0] * n x seg = Segment(n, [INF] * n) Segment(n, [INF] * n) seg INF = 1 << 30 1 << 30 INF b = [[] for i in range(k)] [[] for i in range(k)] b class Segment:
    def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def segfunc(self, x, y):
        return min(x, y)  # 変える class Segment:
    def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def segfunc(self, x, y):
        return min(x, y)  # 変える Segment d = [int(input()) for i in range(q)] [int(input()) for i in range(q)] d input = sys.stdin.readline sys.stdin.readline input t, x = [0] * n, [0] * n, [0] * n [0] * n t k = len(com) + 1 len(com) + 1 k c = [[] for i in range(k)] [[] for i in range(k)] c q = map(int, input().split()) map(int, input().split()) q a = [INF] * k [INF] * k a def compress(arr):
    *XS, = set(arr)
    XS.sort()
    return {e: i for i, e in enumerate(XS)} def compress(arr):
    *XS, = set(arr)
    XS.sort()
    return {e: i for i, e in enumerate(XS)} compress
import sys
input = sys.stdin.readline
# Segment Tree
# segfunc : min, +, *, xor, gcd など
# identity_element : 単位元(min:inf, 和:0, 積:1, xor:0, gcd:0)


class Segment:
    def __init__(self, N, init_val):
        """[セグメント木]

        Args:
            N ([int]): [要素数]
            init_val ([list]): [初期化する値]
        """
        self.identity_element = 2 ** 31 - 1  # 変える
        self.N0 = 1 << (N - 1).bit_length()
        # 0-indexedで管理
        self.dat = [self.identity_element] * (2 * self.N0)
        # 値を代入
        for i in range(N):
            self.dat[i + self.N0 - 1] = init_val[i]
        # 構築
        for i in range(self.N0 - 2, -1, -1):
            self.dat[i] = self.segfunc(self.dat[2 * i + 1], self.dat[2 * i + 2])

    # k番目の要素の値をxに変更
    def update(self, k, x):
        k += self.N0 - 1
        self.dat[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.dat[k] = self.segfunc(self.dat[2 * k + 1], self.dat[2 * k + 2])

    # 区間[l,r)の最小値を求める
    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        s = self.identity_element
        # 区間を列挙しながら最小値を求める
        while L < R:
            if R & 1:
                R -= 1
                s = self.segfunc(s, self.dat[R - 1])
            if L & 1:
                s = self.segfunc(s, self.dat[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def segfunc(self, x, y):
        return min(x, y)  # 変える


def compress(arr):
    *XS, = set(arr)
    XS.sort()
    return {e: i for i, e in enumerate(XS)}


n, q = map(int, input().split())
s, t, x = [0] * n, [0] * n, [0] * n
for i in range(n):
    s[i], t[i], x[i] = map(int, input().split())
    s[i] -= x[i]
    t[i] -= x[i]
    s[i] = max(s[i], 0)
    t[i] = max(t[i], 0)

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

com = compress(s + t + d)
k = len(com) + 1

for i in range(n):
    s[i] = com[s[i]]
    t[i] = com[t[i]]

for i in range(q):
    d[i] = com[d[i]]
INF = 1 << 30
a = [INF] * k
b = [[] for i in range(k)]
c = [[] for i in range(k)]
seg = Segment(n, [INF] * n)
for i in range(n):
    b[s[i]].append(i)
    c[t[i]].append(i)

for i in range(k):
    for j in b[i]:
        seg.update(j, x[j])
    for j in c[i]:
        seg.update(j, INF)
    a[i] = seg.query(0, n)

for i in d:
    print(-1 if a[i] == INF else a[i])
