# using main() makes code faster from the point of view of "access to variables in global name-space"
# def main():

""" convenient functions
# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
"""

import sys
sys.setrecursionlimit(10**7)
from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
# accumulate() returns iterator! to get list: list(accumulate())
from math import factorial, ceil, floor
def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r)
from bisect import bisect_left, bisect_right
from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
from operator import itemgetter
# ex1: List.sort(key=itemgetter(1))
# ex2: sorted(tuples, key=itemgetter(1,2))
from functools import reduce
def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False)
def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False)

from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n)
INF = 10 ** 18
MOD = 10 ** 9 + 7
modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p)
def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t
def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l
def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
def modadd(a, b, p = MOD):
    return (a + b) % MOD
def modsub(a, b, p = MOD):
    return (a - b) % p
def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p
def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p))

""" initialize variables and set inputs
# initialize variables
    # to initialize list, use [0] * n
    # to initialize two dimentional array, use [[0] * N for _ in range(N)]
# set inputs
    # open(0).read() is a convenient method:
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
# preprocessing
    # transpose = [x for x in zip(*data)]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    # flat = [flatten for inner in data for flatten in inner]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
# calculate and output
    # output pattern
    # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
"""

# functions used
r = lambda: sys.stdin.readline().strip()
r_int = lambda: int(r())
R = lambda: list(map(int, r().split()))
Rfloat = lambda: list(map(float, r().split()))
Rtuple = lambda: tuple(map(int, r().split()))
Rmap = lambda: map(int, r().split())

""" how to treat input
# single int: int(r())
# single string: r()
# single float: float(r())
# line int: R()
# line string: r().split()
# line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
# lines int: [R() for _ in range(n)]
"""

# main
N, Q = R()
STX = [R() for _ in range(N)]
STX.sort(key=itemgetter(2))

D = [int(r()) for _ in range(Q)]
Stopped = [-1] * Q
ans = [-1] * Q

for s, t, x in STX:
    l = bisect_left(D, s-x)
    r = bisect_left(D,t-x)
    a = l
    while a < r:
        if Stopped[a] == -1:
            ans[a] = x
            Stopped[a] = r
            a += 1
        else:
            a = Stopped[a]

for i in ans:
    print(i)

"""memo: how to use defaultdict of list
# initialize
Dic = defaultdict(list)
# append / extend
Dic[x].append(y)
# for
for k, v in Dic.items():
"""

# if __name__ == '__main__':
#     main() """ convenient functions
# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
""" import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 from itertools import accumulate, combinations, permutations, product from math import factorial, ceil, floor def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct factorize """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """ fct = [] fct [] b, e = 2, 0 b 2 e 0 while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
     b * b <= n b * b b b n while n % b == 0:
            n = n // b
            e = e + 1
         n % b == 0 n % b n b 0 n = n // b n n // b n b e = e + 1 e e + 1 e 1 if e > 0:
            fct.append((b, e))
         e > 0 e 0 fct.append((b, e)) fct.append fct append (b, e) b e b, e = b + 1, 0 b b + 1 b 1 e 0 if n > 1:
        fct.append((n, 1))
     n > 1 n 1 fct.append((n, 1)) fct.append fct append (n, 1) n 1 return fct fct n n def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result combinations_count """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """ if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
     n < 0 or r < 0 n < 0 n 0 r < 0 r 0 raise Exception('combinations_count(n, r) not defined when n or r is negative') Exception('combinations_count(n, r) not defined when n or r is negative') Exception 'combinations_count(n, r) not defined when n or r is negative' if n - r < r: r = n - r
     n - r < r n - r n r r if r < 0: return 0
     r < 0 r 0 if r == 0: return 1
     r == 0 r 0 if r == 1: return n
     r == 1 r 1 n - r + k + 1 for k in range(r) for k in range(r) k range(r) range r for k in range(r) n - r + k + 1 n - r + k n - r n r k 1 numerator = [n - r + k + 1 for k in range(r)] numerator [n - r + k + 1 for k in range(r)] k + 1 for k in range(r) for k in range(r) k range(r) range r for k in range(r) k + 1 k 1 denominator = [k + 1 for k in range(r)] denominator [k + 1 for k in range(r)] for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
     p range(2,r+1) range 2 r+1 r 1 pivot = denominator[p - 1] pivot denominator[p - 1] denominator p - 1 p 1 if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
     pivot > 1 pivot 1 offset = (n - r) % p offset (n - r) % p n - r n r p for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
     k range(p-1,r,p) range p-1 p 1 r p numerator[k - offset] /= pivot numerator[k - offset] numerator k - offset k offset pivot denominator[k] /= pivot denominator[k] denominator k pivot result = 1 result 1 for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
     k range(r) range r if numerator[k] > 1:
            result *= int(numerator[k])
     numerator[k] > 1 numerator[k] numerator k 1 result *= int(numerator[k]) result int(numerator[k]) int numerator[k] numerator k return result result n n r r def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r) combinations_with_replacement_count """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """ if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r) n < 0 or r < 0 n < 0 n 0 r < 0 r 0 raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative') Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative') Exception 'combinations_with_replacement_count(n, r) not defined when n or r is negative' elif n == 0:
        return 1
     n == 0 n 0 return 1 1 return combinations_count(n + r - 1, r) combinations_count(n + r - 1, r) combinations_count n + r - 1 n + r n r 1 r n n r r from bisect import bisect_left, bisect_right from collections import deque, Counter, defaultdict from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest from copy import deepcopy, copy from operator import itemgetter from functools import reduce def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False) chmin """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """ if x > y:
        x = y
        return (x, True)
    else:
        return (x, False) x > y x y x = y x y return (x, True) (x, True) x True return (x, False) (x, False) x False x x y y def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False) chmax """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """ if x < y:
        x = y
        return (x, True)
    else:
        return (x, False) x < y x y x = y x y return (x, True) (x, True) x True return (x, False) (x, False) x False x x y y from fractions import gcd def gcds(numbers):
    return reduce(gcd, numbers) gcds return reduce(gcd, numbers) reduce(gcd, numbers) reduce gcd numbers numbers numbers def lcm(x, y):
    return (x * y) // gcd(x, y) lcm return (x * y) // gcd(x, y) (x * y) // gcd(x, y) x * y x y gcd(x, y) gcd x y x x y y def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n) lcms return reduce(lcm, numbers, 1) reduce(lcm, numbers, 1) reduce lcm numbers 1 numbers numbers INF = 10 ** 18 INF 10 ** 18 10 18 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 modpow = lambda a, n, p = MOD: pow(a, n, p) modpow lambda a, n, p = MOD: pow(a, n, p) pow(a, n, p) pow a n p a n p = MOD MOD def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p) modinv return modpow(a, p-2, p) modpow(a, p-2, p) modpow a p-2 p 2 p a a p = MOD p MOD def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t modinv_list if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t n <= 1 n 1 return [0,1][:n+1] [0,1][:n+1] [0,1] 0 1 :n+1 n+1 n 1 inv_t = [0,1] inv_t [0,1] 0 1 for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
         i range(2, n+1) range 2 n+1 n 1 inv_t += [inv_t[p % i] * (p - int(p / i)) % p] inv_t [inv_t[p % i] * (p - int(p / i)) % p] inv_t[p % i] * (p - int(p / i)) % p inv_t[p % i] * (p - int(p / i)) inv_t[p % i] inv_t p % i p i p - int(p / i) p int(p / i) int p / i p i p return inv_t inv_t n n p = MOD p MOD def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l modfactorial_list if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l n == 0 n 0 return [1] [1] 1 l = [0] * (n+1) l [0] * (n+1) [0] 0 n+1 n 1 tmp = 1 tmp 1 for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
         i range(1, n+1) range 1 n+1 n 1 tmp = tmp * i % p tmp tmp * i % p tmp * i tmp i p l[i] = tmp l[i] l i tmp return l l n n p = MOD p MOD def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p modcomb from math import factorial if n < 0 or k < 0 or n < k: return 0
     n < 0 or k < 0 or n < k n < 0 or k < 0 n < 0 n 0 k < 0 k 0 n < k n k if n == 0 or k == 0: return 1
     n == 0 or k == 0 n == 0 n 0 k == 0 k 0 if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
     len(fac_list) <= n len(fac_list) len fac_list n a = factorial(n) % p a factorial(n) % p factorial(n) factorial n p b = factorial(k) % p b factorial(k) % p factorial(k) factorial k p c = factorial(n-k) % p c factorial(n-k) % p factorial(n-k) factorial n-k n k p a = fac_list[n] a fac_list[n] fac_list n b = fac_list[k] b fac_list[k] fac_list k c = fac_list[n-k] c fac_list[n-k] fac_list n-k n k return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p a * modpow(b, p-2, p) * modpow(c, p-2, p) a * modpow(b, p-2, p) a modpow(b, p-2, p) modpow b p-2 p 2 p modpow(c, p-2, p) modpow c p-2 p 2 p p n n k k fac_list = [] fac_list [] p = MOD p MOD def modadd(a, b, p = MOD):
    return (a + b) % MOD modadd return (a + b) % MOD (a + b) % MOD a + b a b MOD a a b b p = MOD p MOD def modsub(a, b, p = MOD):
    return (a - b) % p modsub return (a - b) % p (a - b) % p a - b a b p a a b b p = MOD p MOD def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p modmul return ((a % p) * (b % p)) % p ((a % p) * (b % p)) % p (a % p) * (b % p) a % p a p b % p b p p a a b b p = MOD p MOD def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p)) moddiv return modmul(a, modpow(b, p-2, p)) modmul(a, modpow(b, p-2, p)) modmul a modpow(b, p-2, p) modpow b p-2 p 2 p a a b b p = MOD p MOD """ initialize variables and set inputs
# initialize variables
    # to initialize list, use [0] * n
    # to initialize two dimentional array, use [[0] * N for _ in range(N)]
# set inputs
    # open(0).read() is a convenient method:
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
# preprocessing
    # transpose = [x for x in zip(*data)]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    # flat = [flatten for inner in data for flatten in inner]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
# calculate and output
    # output pattern
    # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
""" r = lambda: sys.stdin.readline().strip() r lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip r_int = lambda: int(r()) r_int lambda: int(r()) int(r()) int r() r R = lambda: list(map(int, r().split())) R lambda: list(map(int, r().split())) list(map(int, r().split())) list map(int, r().split()) map int r().split() ().split () r split Rfloat = lambda: list(map(float, r().split())) Rfloat lambda: list(map(float, r().split())) list(map(float, r().split())) list map(float, r().split()) map float r().split() ().split () r split Rtuple = lambda: tuple(map(int, r().split())) Rtuple lambda: tuple(map(int, r().split())) tuple(map(int, r().split())) tuple map(int, r().split()) map int r().split() ().split () r split Rmap = lambda: map(int, r().split()) Rmap lambda: map(int, r().split()) map(int, r().split()) map int r().split() ().split () r split """ how to treat input
# single int: int(r())
# single string: r()
# single float: float(r())
# line int: R()
# line string: r().split()
# line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
# lines int: [R() for _ in range(n)]
""" N, Q = R() N R() R Q R() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) R() R STX = [R() for _ in range(N)] STX [R() for _ in range(N)] STX.sort(key=itemgetter(2)) STX.sort STX sort key=itemgetter(2) key itemgetter(2) itemgetter 2 int(r()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(r()) int r() r D = [int(r()) for _ in range(Q)] D [int(r()) for _ in range(Q)] Stopped = [-1] * Q Stopped [-1] * Q [-1] -1 Q ans = [-1] * Q ans [-1] * Q [-1] -1 Q for s, t, x in STX:
    l = bisect_left(D, s-x)
    r = bisect_left(D,t-x)
    a = l
    while a < r:
        if Stopped[a] == -1:
            ans[a] = x
            Stopped[a] = r
            a += 1
        else:
            a = Stopped[a] s t x STX l = bisect_left(D, s-x) l bisect_left(D, s-x) bisect_left D s-x s x r = bisect_left(D,t-x) r bisect_left(D,t-x) bisect_left D t-x t x a = l a l while a < r:
        if Stopped[a] == -1:
            ans[a] = x
            Stopped[a] = r
            a += 1
        else:
            a = Stopped[a] a < r a r if Stopped[a] == -1:
            ans[a] = x
            Stopped[a] = r
            a += 1
        else:
            a = Stopped[a] Stopped[a] == -1 Stopped[a] Stopped a -1 ans[a] = x ans[a] ans a x Stopped[a] = r Stopped[a] Stopped a r a += 1 a 1 a = Stopped[a] a Stopped[a] Stopped a for i in ans:
    print(i) i ans print(i) print i """memo: how to use defaultdict of list
# initialize
Dic = defaultdict(list)
# append / extend
Dic[x].append(y)
# for
for k, v in Dic.items():
""" def lcm(x, y):
    return (x * y) // gcd(x, y) def lcm(x, y):
    return (x * y) // gcd(x, y) lcm Q = R() R() Q r_int = lambda: int(r()) lambda: int(r()) r_int def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False) def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False) chmin def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p modmul def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r) def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r) combinations_with_replacement_count modpow = lambda a, n, p = MOD: pow(a, n, p) lambda a, n, p = MOD: pow(a, n, p) modpow r = bisect_left(D,t-x) bisect_left(D,t-x) r Rtuple = lambda: tuple(map(int, r().split())) lambda: tuple(map(int, r().split())) Rtuple a = l l a def modsub(a, b, p = MOD):
    return (a - b) % p def modsub(a, b, p = MOD):
    return (a - b) % p modsub INF = 10 ** 18 10 ** 18 INF N, Q = R() R() N STX = [R() for _ in range(N)] [R() for _ in range(N)] STX def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result combinations_count MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD D = [int(r()) for _ in range(Q)] [int(r()) for _ in range(Q)] D def gcds(numbers):
    return reduce(gcd, numbers) def gcds(numbers):
    return reduce(gcd, numbers) gcds def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p)) def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p)) moddiv def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p) def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p) modinv a = Stopped[a] Stopped[a] a def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct factorize def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l modfactorial_list def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n) def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n) lcms def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False) def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False) chmax Rfloat = lambda: list(map(float, r().split())) lambda: list(map(float, r().split())) Rfloat Rmap = lambda: map(int, r().split()) lambda: map(int, r().split()) Rmap R = lambda: list(map(int, r().split())) lambda: list(map(int, r().split())) R def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p modcomb Stopped = [-1] * Q [-1] * Q Stopped def modadd(a, b, p = MOD):
    return (a + b) % MOD def modadd(a, b, p = MOD):
    return (a + b) % MOD modadd def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t modinv_list ans = [-1] * Q [-1] * Q ans l = bisect_left(D, s-x) bisect_left(D, s-x) l a += 1 1 a r = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() r
# using main() makes code faster from the point of view of "access to variables in global name-space"
# def main():

""" convenient functions
# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
"""

import sys
sys.setrecursionlimit(10**7)
from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
# accumulate() returns iterator! to get list: list(accumulate())
from math import factorial, ceil, floor
def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    # TODO: How should I do when n - r is negative?
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r)
from bisect import bisect_left, bisect_right
from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
from operator import itemgetter
# ex1: List.sort(key=itemgetter(1))
# ex2: sorted(tuples, key=itemgetter(1,2))
from functools import reduce
def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False)
def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False)

from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers):
    return reduce(lcm, numbers, 1)

# first create factorial_list
# fac_list = mod_factorial_list(n)
INF = 10 ** 18
MOD = 10 ** 9 + 7
modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
def modinv(a, p = MOD):
    # evaluate reciprocal using Fermat's little theorem:
    # a**(p-1) is identical to 1 (mod p) when a and p is coprime
    return modpow(a, p-2, p)
def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t
def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l
def modcomb(n, k, fac_list = [], p = MOD):
    # fac_list = modfactorial_list(100)
    # print(modcomb(100, 5, modfactorial_list(100)))
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
def modadd(a, b, p = MOD):
    return (a + b) % MOD
def modsub(a, b, p = MOD):
    return (a - b) % p
def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p
def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p))

""" initialize variables and set inputs
# initialize variables
    # to initialize list, use [0] * n
    # to initialize two dimentional array, use [[0] * N for _ in range(N)]
# set inputs
    # open(0).read() is a convenient method:
    # ex) n, m, *x = map(int, open(0).read().split())
    #     min(x[::2]) - max(x[1::2])
    # ex2) *x, = map(int, open(0).read().split())
    #     don't forget to add comma after *x if only one variable is used
# preprocessing
    # transpose = [x for x in zip(*data)]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    # flat = [flatten for inner in data for flatten in inner]
    # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
# calculate and output
    # output pattern
    # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
"""

# functions used
r = lambda: sys.stdin.readline().strip()
r_int = lambda: int(r())
R = lambda: list(map(int, r().split()))
Rfloat = lambda: list(map(float, r().split()))
Rtuple = lambda: tuple(map(int, r().split()))
Rmap = lambda: map(int, r().split())

""" how to treat input
# single int: int(r())
# single string: r()
# single float: float(r())
# line int: R()
# line string: r().split()
# line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
# lines int: [R() for _ in range(n)]
"""

# main
N, Q = R()
STX = [R() for _ in range(N)]
STX.sort(key=itemgetter(2))

D = [int(r()) for _ in range(Q)]
Stopped = [-1] * Q
ans = [-1] * Q

for s, t, x in STX:
    l = bisect_left(D, s-x)
    r = bisect_left(D,t-x)
    a = l
    while a < r:
        if Stopped[a] == -1:
            ans[a] = x
            Stopped[a] = r
            a += 1
        else:
            a = Stopped[a]

for i in ans:
    print(i)

"""memo: how to use defaultdict of list
# initialize
Dic = defaultdict(list)
# append / extend
Dic[x].append(y)
# for
for k, v in Dic.items():
"""

# if __name__ == '__main__':
#     main()