import math
import numpy as np
import decimal
import collections
import itertools
import sys
import random
#Union-Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.par[self.find(x)]

#素数関連
def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0]
def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    prime_number = 7
    difference = 4
    while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
    return True
#Prime-Factorize
def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
#nCr
mod = 10 ** 9 + 7
class nCr():
    def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
    def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法
def extgcd(a, b, d = 0):
    g = a
    if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
    return x, y, g
#BIT
class BinaryIndexedTree():
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array
class AssociativeArray():
    def __init__(self, q):
        self.dic = dict()
        self.q = q
    def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum
def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return res
    res += y_max * (n + (-x_max // a))
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res
#Z-Algorithm
def z_algorithm(s):
    str_len = len(s)
    res = [0] * str_len
    res[str_len - 1] = str_len
    i, j = 1, 0
    while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
    return res
class Manacher():
    def __init__(self, s):
        self.s = s
    def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt
def mod_sqrt(a, p):
    if a == 0:
        return 0
    if p == 2:
        return 1
    k = (p - 1) // 2
    if pow(a, k, p) != 1:
        return -1
    while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
    k += 1
    w, x, y, z = n, 1, 1, 0
    while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
    return y
import bisect
n, q = map(int, input().split())
stx = [list(map(int, input().split())) for i in range(n)]
d = [int(input()) for i in range(q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(q)]
lis = [-1 for i in range(q)]
for s, t, x in stx:
    l = bisect.bisect_left(d, s - x)
    r = bisect.bisect_left(d, t - x)
    while l < r:
        if lis[l] == -1:
            ans[l] = x
            lis[l] = r
            l += 1
        else:
            l = lis[l]
print(*ans, sep="\n") import math math import numpy as np numpy import decimal decimal import collections collections import itertools itertools import sys sys import random random class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.par[self.find(x)]

#素数関連 UnionFind def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
     __init__ self.n = n self.n self n n -1 for i in range(self.n) for i in range(self.n) i range(self.n) range self.n self n for i in range(self.n) -1 self.par = [-1 for i in range(self.n)] self.par self par [-1 for i in range(self.n)] self self n n def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
     find if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
     self.par[x] < 0 self.par[x] self.par self par x 0 return x x self.par[x] = self.find(self.par[x]) self.par[x] self.par self par x self.find(self.par[x]) self.find self find self.par[x] self.par self par x return self.par[x] self.par[x] self.par self par x self self x x def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
     unite p = self.find(x) p self.find(x) self.find self find x q = self.find(y) q self.find(y) self.find self find y if p == q:
            return None
         p == q p q return None None if p > q:
            p, q = q, p
         p > q p q p, q = q, p p q q p self.par[p] += self.par[q] self.par[p] self.par self par p self.par[q] self.par self par q self.par[q] = p self.par[q] self.par self par q p self self x x y y def same(self, x, y):
        return self.find(x) == self.find(y)
     same return self.find(x) == self.find(y) self.find(x) == self.find(y) self.find(x) self.find self find x self.find(y) self.find self find y self self x x y y def size(self, x):
        return -self.par[self.find(x)]

#素数関連 size return -self.par[self.find(x)] -self.par[self.find(x)] self.par[self.find(x)] self.par self par self.find(x) self.find self find x self self x x def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0] prime_numbers if x < 2:
        return []
     x < 2 x 2 return [] [] i for i in range(x) for i in range(x) i range(x) range x for i in range(x) i prime_numbers = [i for i in range(x)] prime_numbers [i for i in range(x)] prime_numbers[1] = 0 prime_numbers[1] prime_numbers 1 0 for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
     prime_number prime_numbers if prime_number > math.sqrt(x):
            break
         prime_number > math.sqrt(x) prime_number math.sqrt(x) math.sqrt math sqrt x break if prime_number == 0:
            continue
         prime_number == 0 prime_number 0 continue for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
     composite_number range(2 * prime_number, x, prime_number) range 2 * prime_number 2 prime_number x prime_number prime_numbers[composite_number] = 0 prime_numbers[composite_number] prime_numbers composite_number 0 prime_number for prime_number in prime_numbers if prime_number != 0 for prime_number in prime_numbers if prime_number != 0 prime_number prime_numbers prime_number != 0 prime_number 0 if prime_number != 0 prime_number return [prime_number for prime_number in prime_numbers if prime_number != 0] [prime_number for prime_number in prime_numbers if prime_number != 0] x x def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    prime_number = 7
    difference = 4
    while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
    return True
#Prime-Factorize is_prime if x < 2:
        return False
     x < 2 x 2 return False False if x == 2 or x == 3 or x == 5:
        return True
     x == 2 or x == 3 or x == 5 x == 2 or x == 3 x == 2 x 2 x == 3 x 3 x == 5 x 5 return True True if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
     x % 2 == 0 or x % 3 == 0 or x % 5 == 0 x % 2 == 0 or x % 3 == 0 x % 2 == 0 x % 2 x 2 0 x % 3 == 0 x % 3 x 3 0 x % 5 == 0 x % 5 x 5 0 return False False prime_number = 7 prime_number 7 difference = 4 difference 4 while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
     prime_number <= math.sqrt(x) prime_number math.sqrt(x) math.sqrt math sqrt x if x % prime_number == 0:
            return False
         x % prime_number == 0 x % prime_number x prime_number 0 return False False prime_number += difference prime_number difference difference = 6 - difference difference 6 - difference 6 difference return True True x x def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
#nCr prime_factorize res = [] res [] while n % 2 == 0:
        res.append(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 res.append(2) res.append res append 2 n //= 2 n 2 f = 3 f 3 while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
     f ** 2 <= n f ** 2 f 2 n if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 res.append(f) res.append res append f n //= f n f f += 2 f 2 if n != 1:
        res.append(n)
     n != 1 n 1 res.append(n) res.append res append n return res res n n mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 class nCr():
    def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
    def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法 nCr def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
     __init__ self.n = n self.n self n n self.fa = [1] * (self.n + 1) self.fa self fa [1] * (self.n + 1) [1] 1 self.n + 1 self.n self n 1 self.fi = [1] * (self.n + 1) self.fi self fi [1] * (self.n + 1) [1] 1 self.n + 1 self.n self n 1 for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
     i range(1, self.n + 1) range 1 self.n + 1 self.n self n 1 self.fa[i] = self.fa[i - 1] * i % mod self.fa[i] self.fa self fa i self.fa[i - 1] * i % mod self.fa[i - 1] * i self.fa[i - 1] self.fa self fa i - 1 i 1 i mod self.fi[i] = pow(self.fa[i], mod - 2, mod) self.fi[i] self.fi self fi i pow(self.fa[i], mod - 2, mod) pow self.fa[i] self.fa self fa i mod - 2 mod 2 mod self self n n def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法 comb if n < r:return 0
         n < r n r if n < 0 or r < 0:return 0
         n < 0 or r < 0 n < 0 n 0 r < 0 r 0 return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod self.fa[n] * self.fi[r] % mod * self.fi[n - r] self.fa[n] * self.fi[r] % mod self.fa[n] * self.fi[r] self.fa[n] self.fa self fa n self.fi[r] self.fi self fi r mod self.fi[n - r] self.fi self fi n - r n r mod self self n n r r def extgcd(a, b, d = 0):
    g = a
    if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
    return x, y, g
#BIT extgcd g = a g a if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
     b == 0 b 0 x, y = 1, 0 x 1 y 0 x, y, g = extgcd(b, a % b) x extgcd(b, a % b) extgcd b a % b a b y g x, y = y, x - a // b * y x y y x - a // b * y x a // b * y a // b a b y return x, y, g return x, y, g x y g a a b b d = 0 d 0 class BinaryIndexedTree():
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array BinaryIndexedTree def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
     __init__ self.n = n self.n self n n self.BIT = [0] * (self.n + 1) self.BIT self BIT [0] * (self.n + 1) [0] 0 self.n + 1 self.n self n 1 self self n n def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
     add while i <= self.n:
            self.BIT[i] += x
            i += i & -i
     i <= self.n i self.n self n self.BIT[i] += x self.BIT[i] self.BIT self BIT i x i += i & -i i i & -i i -i i self self i i x x def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array query res = 0 res 0 while i > 0:
            res += self.BIT[i]
            i -= i & -i
         i > 0 i 0 res += self.BIT[i] res self.BIT[i] self.BIT self BIT i i -= i & -i i i & -i i -i i return res res self self i i class AssociativeArray():
    def __init__(self, q):
        self.dic = dict()
        self.q = q
    def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum AssociativeArray def __init__(self, q):
        self.dic = dict()
        self.q = q
     __init__ self.dic = dict() self.dic self dic dict() dict self.q = q self.q self q q self self q q def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum solve for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum i range(self.q) range self.q self q Query = list(map(int, input().split())) Query list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum Query[0] == 0 Query[0] Query 0 0 x, y, z = Query x Query y z self.dic[y] = z self.dic[y] self.dic self dic y z x, y = Query x Query y if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum y in self.dic y self.dic self dic print(self.dic[y]) print self.dic[y] self.dic self dic y print(0) print 0 self self def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return res
    res += y_max * (n + (-x_max // a))
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res
#Z-Algorithm floor_sum res = 0 res 0 if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
     a >= m a m res += (n - 1) * n * (a // m) // 2 res (n - 1) * n * (a // m) // 2 (n - 1) * n * (a // m) (n - 1) * n n - 1 n 1 n a // m a m 2 a %= m a m if b >= m:
        res += n * (b // m)
        b %= m
     b >= m b m res += n * (b // m) res n * (b // m) n b // m b m b %= m b m y_max = (a * n + b) // m y_max (a * n + b) // m a * n + b a * n a n b m x_max = y_max * m - b x_max y_max * m - b y_max * m y_max m b if y_max == 0:
        return res
     y_max == 0 y_max 0 return res res res += y_max * (n + (-x_max // a)) res y_max * (n + (-x_max // a)) y_max n + (-x_max // a) n -x_max // a -x_max x_max a res += floor_sum(y_max, a, m, (a - x_max % a) % a) res floor_sum(y_max, a, m, (a - x_max % a) % a) floor_sum y_max a m (a - x_max % a) % a a - x_max % a a x_max % a x_max a a return res res n n m m a a b b def z_algorithm(s):
    str_len = len(s)
    res = [0] * str_len
    res[str_len - 1] = str_len
    i, j = 1, 0
    while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
    return res z_algorithm str_len = len(s) str_len len(s) len s res = [0] * str_len res [0] * str_len [0] 0 str_len res[str_len - 1] = str_len res[str_len - 1] res str_len - 1 str_len 1 str_len i, j = 1, 0 i 1 j 0 while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
     i < str_len i str_len while i + j < str_len and s[i + j] == s[j]:
            j += 1
         i + j < str_len and s[i + j] == s[j] i + j < str_len i + j i j str_len s[i + j] == s[j] s[i + j] s i + j i j s[j] s j j += 1 j 1 res[i] = j res[i] res i j if j == 0:
            i += 1
            continue
         j == 0 j 0 i += 1 i 1 continue k = 1 k 1 while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
         i + k < str_len and j > res[k] + k i + k < str_len i + k i k str_len j > res[k] + k j res[k] + k res[k] res k k res[i + k] = res[k] res[i + k] res i + k i k res[k] res k k += 1 k 1 i += k i k j -= k j k return res res s s class Manacher():
    def __init__(self, s):
        self.s = s
    def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt Manacher def __init__(self, s):
        self.s = s
     __init__ self.s = s self.s self s s self self s s def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt coustruct i, j = 0, 0 i 0 j 0 s_len = len(self.s) s_len len(self.s) len self.s self s res = [0] * s_len res [0] * s_len [0] 0 s_len while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt i < s_len i s_len while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
             i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j] i - j >= 0 and i + j < s_len i - j >= 0 i - j i j 0 i + j < s_len i + j i j s_len self.s[i - j] == self.s[i + j] self.s[i - j] self.s self s i - j i j self.s[i + j] self.s self s i + j i j j += 1 j 1 res[i] = j res[i] res i j k = 1 k 1 while i - k >= 0 and k + res[i - k] < j:
                k += 1
             i - k >= 0 and k + res[i - k] < j i - k >= 0 i - k i k 0 k + res[i - k] < j k + res[i - k] k res[i - k] res i - k i k j k += 1 k 1 i += k i k j -= k j k self self def mod_sqrt(a, p):
    if a == 0:
        return 0
    if p == 2:
        return 1
    k = (p - 1) // 2
    if pow(a, k, p) != 1:
        return -1
    while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
    k += 1
    w, x, y, z = n, 1, 1, 0
    while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
    return y mod_sqrt if a == 0:
        return 0
     a == 0 a 0 return 0 0 if p == 2:
        return 1
     p == 2 p 2 return 1 1 k = (p - 1) // 2 k (p - 1) // 2 p - 1 p 1 2 if pow(a, k, p) != 1:
        return -1
     pow(a, k, p) != 1 pow(a, k, p) pow a k p 1 return -1 -1 while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
     True n = random.randint(2, p - 1) n random.randint(2, p - 1) random.randint random randint 2 p - 1 p 1 r = (n ** 2 - a) % p r (n ** 2 - a) % p n ** 2 - a n ** 2 n 2 a p if r == 0:
            return n
         r == 0 r 0 return n n if pow(r, k, p) == p - 1:
            break
     pow(r, k, p) == p - 1 pow(r, k, p) pow r k p p - 1 p 1 break k += 1 k 1 w, x, y, z = n, 1, 1, 0 w n x 1 y 1 z 0 while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
     k if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
         k % 2 k 2 y, z = w * y + r * x * z, x * y + w * z y w * y + r * x * z w * y w y r * x * z r * x r x z z x * y + w * z x * y x y w * z w z w, x = w * w + r * x * x, 2 * w * x w w * w + r * x * x w * w w w r * x * x r * x r x x x 2 * w * x 2 * w 2 w x w %= p w p x %= p x p y %= p y p z %= p z p k >>= 1 k 1 return y y a a p p import bisect bisect n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q list(map(int, input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split stx = [list(map(int, input().split())) for i in range(n)] stx [list(map(int, input().split())) for i in range(n)] 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)] stx.sort(key=lambda x: x[2]) stx.sort stx sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x -1 for i in range(q) for i in range(q) i range(q) range q for i in range(q) -1 ans = [-1 for i in range(q)] ans [-1 for i in range(q)] -1 for i in range(q) for i in range(q) i range(q) range q for i in range(q) -1 lis = [-1 for i in range(q)] lis [-1 for i in range(q)] for s, t, x in stx:
    l = bisect.bisect_left(d, s - x)
    r = bisect.bisect_left(d, t - x)
    while l < r:
        if lis[l] == -1:
            ans[l] = x
            lis[l] = r
            l += 1
        else:
            l = lis[l] s t x stx l = bisect.bisect_left(d, s - x) l bisect.bisect_left(d, s - x) bisect.bisect_left bisect bisect_left d s - x s x r = bisect.bisect_left(d, t - x) r bisect.bisect_left(d, t - x) bisect.bisect_left bisect bisect_left d t - x t x while l < r:
        if lis[l] == -1:
            ans[l] = x
            lis[l] = r
            l += 1
        else:
            l = lis[l] l < r l r if lis[l] == -1:
            ans[l] = x
            lis[l] = r
            l += 1
        else:
            l = lis[l] lis[l] == -1 lis[l] lis l -1 ans[l] = x ans[l] ans l x lis[l] = r lis[l] lis l r l += 1 l 1 l = lis[l] l lis[l] lis l print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" def extgcd(a, b, d = 0):
    g = a
    if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
    return x, y, g
#BIT def extgcd(a, b, d = 0):
    g = a
    if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
    return x, y, g
#BIT extgcd class Manacher():
    def __init__(self, s):
        self.s = s
    def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt class Manacher():
    def __init__(self, s):
        self.s = s
    def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt Manacher n, q = map(int, input().split()) map(int, input().split()) n def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0] def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0] prime_numbers l = lis[l] lis[l] l mod = 10 ** 9 + 7 10 ** 9 + 7 mod l += 1 1 l class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.par[self.find(x)]

#素数関連 class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.par[self.find(x)]

#素数関連 UnionFind q = map(int, input().split()) map(int, input().split()) q l = bisect.bisect_left(d, s - x) bisect.bisect_left(d, s - x) l r = bisect.bisect_left(d, t - x) bisect.bisect_left(d, t - x) r ans = [-1 for i in range(q)] [-1 for i in range(q)] ans def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    prime_number = 7
    difference = 4
    while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
    return True
#Prime-Factorize def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    prime_number = 7
    difference = 4
    while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
    return True
#Prime-Factorize is_prime class AssociativeArray():
    def __init__(self, q):
        self.dic = dict()
        self.q = q
    def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum class AssociativeArray():
    def __init__(self, q):
        self.dic = dict()
        self.q = q
    def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum AssociativeArray stx = [list(map(int, input().split())) for i in range(n)] [list(map(int, input().split())) for i in range(n)] stx def z_algorithm(s):
    str_len = len(s)
    res = [0] * str_len
    res[str_len - 1] = str_len
    i, j = 1, 0
    while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
    return res def z_algorithm(s):
    str_len = len(s)
    res = [0] * str_len
    res[str_len - 1] = str_len
    i, j = 1, 0
    while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
    return res z_algorithm lis = [-1 for i in range(q)] [-1 for i in range(q)] lis def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
#nCr def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
#nCr prime_factorize def mod_sqrt(a, p):
    if a == 0:
        return 0
    if p == 2:
        return 1
    k = (p - 1) // 2
    if pow(a, k, p) != 1:
        return -1
    while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
    k += 1
    w, x, y, z = n, 1, 1, 0
    while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
    return y def mod_sqrt(a, p):
    if a == 0:
        return 0
    if p == 2:
        return 1
    k = (p - 1) // 2
    if pow(a, k, p) != 1:
        return -1
    while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
    k += 1
    w, x, y, z = n, 1, 1, 0
    while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
    return y mod_sqrt def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return res
    res += y_max * (n + (-x_max // a))
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res
#Z-Algorithm def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return res
    res += y_max * (n + (-x_max // a))
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res
#Z-Algorithm floor_sum d = [int(input()) for i in range(q)] [int(input()) for i in range(q)] d class BinaryIndexedTree():
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array class BinaryIndexedTree():
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array BinaryIndexedTree class nCr():
    def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
    def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法 class nCr():
    def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
    def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法 nCr
import math
import numpy as np
import decimal
import collections
import itertools
import sys
import random
#Union-Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1 for i in range(self.n)]
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.par[p] += self.par[q]
        self.par[q] = p
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return -self.par[self.find(x)]

#素数関連
def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0]
def is_prime(x):
    if x < 2:
        return False
    if x == 2 or x == 3 or x == 5:
        return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
        return False
    prime_number = 7
    difference = 4
    while prime_number <= math.sqrt(x):
        if x % prime_number == 0:
            return False
        prime_number += difference
        difference = 6 - difference
    return True
#Prime-Factorize
def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
#nCr
mod = 10 ** 9 + 7
class nCr():
    def __init__(self, n):
        self.n = n
        self.fa = [1] * (self.n + 1)
        self.fi = [1] * (self.n + 1)
        for i in range(1, self.n + 1):
            self.fa[i] = self.fa[i - 1] * i % mod
            self.fi[i] = pow(self.fa[i], mod - 2, mod)
    def comb(self, n, r):
        if n < r:return 0
        if n < 0 or r < 0:return 0
        return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod
#拡張Euclidの互除法
def extgcd(a, b, d = 0):
    g = a
    if b == 0:
        x, y = 1, 0
    else:
        x, y, g = extgcd(b, a % b)
        x, y = y, x - a // b * y
    return x, y, g
#BIT
class BinaryIndexedTree():
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)
    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i
    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res
#Associative Array
class AssociativeArray():
    def __init__(self, q):
        self.dic = dict()
        self.q = q
    def solve(self):
        for i in range(self.q):
            Query = list(map(int, input().split()))
            if Query[0] == 0:
                x, y, z = Query
                self.dic[y] = z
            else:
                x, y = Query
                if y in self.dic:
                    print(self.dic[y])
                else:
                    print(0)
#Floor Sum
def floor_sum(n, m, a, b):
    res = 0
    if a >= m:
        res += (n - 1) * n * (a // m) // 2
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    y_max = (a * n + b) // m
    x_max = y_max * m - b
    if y_max == 0:
        return res
    res += y_max * (n + (-x_max // a))
    res += floor_sum(y_max, a, m, (a - x_max % a) % a)
    return res
#Z-Algorithm
def z_algorithm(s):
    str_len = len(s)
    res = [0] * str_len
    res[str_len - 1] = str_len
    i, j = 1, 0
    while i < str_len:
        while i + j < str_len and s[i + j] == s[j]:
            j += 1
        res[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i + k < str_len and j > res[k] + k:
            res[i + k] = res[k]
            k += 1
        i += k
        j -= k
    return res
class Manacher():
    def __init__(self, s):
        self.s = s
    def coustruct(self):
        i, j = 0, 0 
        s_len = len(self.s)
        res = [0] * s_len
        while i < s_len:
            while i - j >= 0 and i + j < s_len and self.s[i - j] == self.s[i + j]:
                j += 1
            res[i] = j
            k = 1
            while i - k >= 0 and k + res[i - k] < j:
                k += 1
            i += k
            j -= k
#mod-sqrt
def mod_sqrt(a, p):
    if a == 0:
        return 0
    if p == 2:
        return 1
    k = (p - 1) // 2
    if pow(a, k, p) != 1:
        return -1
    while True:
        n = random.randint(2, p - 1)
        r = (n ** 2 - a) % p
        if r == 0:
            return n
        if pow(r, k, p) == p - 1:
            break
    k += 1
    w, x, y, z = n, 1, 1, 0
    while k:
        if k % 2:
            y, z = w * y + r * x * z, x * y + w * z
        w, x = w * w + r * x * x, 2 * w * x
        w %= p
        x %= p
        y %= p
        z %= p
        k >>= 1
    return y
import bisect
n, q = map(int, input().split())
stx = [list(map(int, input().split())) for i in range(n)]
d = [int(input()) for i in range(q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(q)]
lis = [-1 for i in range(q)]
for s, t, x in stx:
    l = bisect.bisect_left(d, s - x)
    r = bisect.bisect_left(d, t - x)
    while l < r:
        if lis[l] == -1:
            ans[l] = x
            lis[l] = r
            l += 1
        else:
            l = lis[l]
print(*ans, sep="\n")