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

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す
def query(k):
    return _query(k)[1]

from bisect import bisect_left
from sys import stdin

if __name__ == '__main__':
    n, q = map(int, stdin.readline().rstrip().split())
    stx = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
    l = [int(stdin.readline().rstrip()) for _ in range(q)]

    INF = (-1, 2**31-1)
    N = len(l)
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)

    stx.sort(key=lambda x:x[2], reverse=True)
    for i, (s, t, x) in enumerate(stx):
        i1 = bisect_left(l, s - 0.5 - x)
        i2 = bisect_left(l, t - 0.5 - x)
        update(i1, i2, (i, x))

    for i in range(q):
        tmp = query(i)
        if tmp == INF[1]:
            print(-1)
        else:
            print(tmp) def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 update L = l + N0 L l + N0 l N0 R = r + N0 R r + N0 r N0 while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 L < R L R if R & 1:
            R -= 1
            data[R-1] = v

         R & 1 R 1 R -= 1 R 1 data[R-1] = v data[R-1] data R-1 R 1 v if L & 1:
            data[L-1] = v
            L += 1
         L & 1 L 1 data[L-1] = v data[L-1] data L-1 L 1 v L += 1 L 1 L >>= 1 L 1 R >>= 1 R 1 l l r r v v def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す _query k += N0-1 k N0-1 N0 1 s = INF s INF while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
     k >= 0 k 0 if data[k]:
            s = max(s, data[k])
         data[k] data k s = max(s, data[k]) s max(s, data[k]) max s data[k] data k k = (k - 1) // 2 k (k - 1) // 2 k - 1 k 1 2 return s s k k def query(k):
    return _query(k)[1] query return _query(k)[1] _query(k)[1] (k) _query k 1 k k from bisect import bisect_left from sys import stdin if __name__ == '__main__':
    n, q = map(int, stdin.readline().rstrip().split())
    stx = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
    l = [int(stdin.readline().rstrip()) for _ in range(q)]

    INF = (-1, 2**31-1)
    N = len(l)
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)

    stx.sort(key=lambda x:x[2], reverse=True)
    for i, (s, t, x) in enumerate(stx):
        i1 = bisect_left(l, s - 0.5 - x)
        i2 = bisect_left(l, t - 0.5 - x)
        update(i1, i2, (i, x))

    for i in range(q):
        tmp = query(i)
        if tmp == INF[1]:
            print(-1)
        else:
            print(tmp) __name__ == '__main__' __name__ '__main__' n, q = map(int, stdin.readline().rstrip().split()) n map(int, stdin.readline().rstrip().split()) map int stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split q list(map(int, stdin.readline().rstrip().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, stdin.readline().rstrip().split())) list map(int, stdin.readline().rstrip().split()) map int stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split stx = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)] stx [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)] int(stdin.readline().rstrip()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip l = [int(stdin.readline().rstrip()) for _ in range(q)] l [int(stdin.readline().rstrip()) for _ in range(q)] INF = (-1, 2**31-1) INF (-1, 2**31-1) -1 2**31-1 2**31 2 31 1 N = len(l) N len(l) len l N0 = 2**(N-1).bit_length() N0 2**(N-1).bit_length() 2 (N-1).bit_length() N-1).bit_length N-1 N 1 bit_length data = [None]*(2*N0) data [None]*(2*N0) [None] None 2*N0 2 N0 stx.sort(key=lambda x:x[2], reverse=True) stx.sort stx sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x reverse=True reverse True for i, (s, t, x) in enumerate(stx):
        i1 = bisect_left(l, s - 0.5 - x)
        i2 = bisect_left(l, t - 0.5 - x)
        update(i1, i2, (i, x))

     i (s, t, x) s t x enumerate(stx) enumerate stx i1 = bisect_left(l, s - 0.5 - x) i1 bisect_left(l, s - 0.5 - x) bisect_left l s - 0.5 - x s - 0.5 s 0.5 x i2 = bisect_left(l, t - 0.5 - x) i2 bisect_left(l, t - 0.5 - x) bisect_left l t - 0.5 - x t - 0.5 t 0.5 x update(i1, i2, (i, x)) update i1 i2 (i, x) i x for i in range(q):
        tmp = query(i)
        if tmp == INF[1]:
            print(-1)
        else:
            print(tmp) i range(q) range q tmp = query(i) tmp query(i) query i if tmp == INF[1]:
            print(-1)
        else:
            print(tmp) tmp == INF[1] tmp INF[1] INF 1 print(-1) print -1 print(tmp) print tmp data = [None]*(2*N0) [None]*(2*N0) data N0 = 2**(N-1).bit_length() 2**(N-1).bit_length() N0 stx = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)] [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)] stx def query(k):
    return _query(k)[1] def query(k):
    return _query(k)[1] query n, q = map(int, stdin.readline().rstrip().split()) map(int, stdin.readline().rstrip().split()) n i2 = bisect_left(l, t - 0.5 - x) bisect_left(l, t - 0.5 - x) i2 def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す _query N = len(l) len(l) N tmp = query(i) query(i) tmp INF = (-1, 2**31-1) (-1, 2**31-1) INF q = map(int, stdin.readline().rstrip().split()) map(int, stdin.readline().rstrip().split()) q def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 update i1 = bisect_left(l, s - 0.5 - x) bisect_left(l, s - 0.5 - x) i1 l = [int(stdin.readline().rstrip()) for _ in range(q)] [int(stdin.readline().rstrip()) for _ in range(q)] l
def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す
def query(k):
    return _query(k)[1]

from bisect import bisect_left
from sys import stdin

if __name__ == '__main__':
    n, q = map(int, stdin.readline().rstrip().split())
    stx = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
    l = [int(stdin.readline().rstrip()) for _ in range(q)]

    INF = (-1, 2**31-1)
    N = len(l)
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)

    stx.sort(key=lambda x:x[2], reverse=True)
    for i, (s, t, x) in enumerate(stx):
        i1 = bisect_left(l, s - 0.5 - x)
        i2 = bisect_left(l, t - 0.5 - x)
        update(i1, i2, (i, x))

    for i in range(q):
        tmp = query(i)
        if tmp == INF[1]:
            print(-1)
        else:
            print(tmp)
