def main():
    import sys
    input = lambda : sys.stdin.readline().rstrip()

    n, q = map(int, input().split())
    stx = []
    for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
    stx.sort(reverse=True)
    d = [int(input()) for _ in range(q)]

    N = q
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    INF = (-1, 10**9 + 1)
    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
    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]



    import bisect

    for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

    for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res)
if __name__ == '__main__':
    main()
    
 def main():
    import sys
    input = lambda : sys.stdin.readline().rstrip()

    n, q = map(int, input().split())
    stx = []
    for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
    stx.sort(reverse=True)
    d = [int(input()) for _ in range(q)]

    N = q
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    INF = (-1, 10**9 + 1)
    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
    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]



    import bisect

    for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

    for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res) main import sys sys input = lambda : sys.stdin.readline().rstrip() input lambda : sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q stx = [] stx [] for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
     _ range(n) range n s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x stx.append([x, s - x, t - x]) stx.append stx append [x, s - x, t - x] x s - x s x t - x t x stx.sort(reverse=True) stx.sort stx sort reverse=True reverse True int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input d = [int(input()) for _ in range(q)] d [int(input()) for _ in range(q)] N = q N q 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 INF = (-1, 10**9 + 1) INF (-1, 10**9 + 1) -1 10**9 + 1 10**9 10 9 1 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
     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
     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 import bisect bisect for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

     i (x, start, last) x start last enumerate(stx) enumerate stx l = bisect.bisect_left(d, start) l bisect.bisect_left(d, start) bisect.bisect_left bisect bisect_left d start r = bisect.bisect_left(d, last) r bisect.bisect_left(d, last) bisect.bisect_left bisect bisect_left d last update(l, r, (i, x)) update l r (i, x) i x for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res) i range(q) range q res = query(i) res query(i) query i if res == 10**9 + 1:
            print(-1)
        else:
            print(res) res == 10**9 + 1 res 10**9 + 1 10**9 10 9 1 print(-1) print -1 print(res) print res if __name__ == '__main__':
    main()
     __name__ == '__main__' __name__ '__main__' main() main def main():
    import sys
    input = lambda : sys.stdin.readline().rstrip()

    n, q = map(int, input().split())
    stx = []
    for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
    stx.sort(reverse=True)
    d = [int(input()) for _ in range(q)]

    N = q
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    INF = (-1, 10**9 + 1)
    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
    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]



    import bisect

    for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

    for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res) def main():
    import sys
    input = lambda : sys.stdin.readline().rstrip()

    n, q = map(int, input().split())
    stx = []
    for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
    stx.sort(reverse=True)
    d = [int(input()) for _ in range(q)]

    N = q
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    INF = (-1, 10**9 + 1)
    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
    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]



    import bisect

    for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

    for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res) main
def main():
    import sys
    input = lambda : sys.stdin.readline().rstrip()

    n, q = map(int, input().split())
    stx = []
    for _ in range(n):
        s, t, x = map(int, input().split())
        stx.append([x, s - x, t - x])
    stx.sort(reverse=True)
    d = [int(input()) for _ in range(q)]

    N = q
    N0 = 2**(N-1).bit_length()
    data = [None]*(2*N0)
    INF = (-1, 10**9 + 1)
    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
    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]



    import bisect

    for i, (x, start, last) in enumerate(stx):
        l = bisect.bisect_left(d, start)
        r = bisect.bisect_left(d, last)
        update(l, r, (i, x))

    for i in range(q):
        res = query(i)
        if res == 10**9 + 1:
            print(-1)
        else:
            print(res)
if __name__ == '__main__':
    main()
    

