# Solution using a lazy segment tree

from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


class SegmentTree:  # 0-indexed
    def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

    def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

    def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

    def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res


n, q = map(int, input().split())

Works = []
for _ in range(n):
    s, t, x = map(int, input().split())
    Works.append((s, t, x))
Works = sorted(Works, key=lambda w: -w[2])

People = []
for _ in range(q):
    People.append(int(input()))

ST = SegmentTree([-1]*q)

for s, t, x in Works:
    left = bisect_left(People, s-x)
    right = bisect_left(People, t-x)
    ST.update(left, right, x)

for x in ST.values():
    print(x) from bisect import bisect_left import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline class SegmentTree:  # 0-indexed
    def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

    def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

    def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

    def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res SegmentTree def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

     __init__ self.identity = identity self.identity self identity identity self.n = len(array) self.n self n len(array) len array self.N = 1 << (self.n - 1).bit_length() self.N self N 1 << (self.n - 1).bit_length() 1 (self.n - 1).bit_length() self.n - 1).bit_length self.n - 1 self.n self n 1 bit_length self.tree = [self.identity] * 2 * self.N self.tree self tree [self.identity] * 2 * self.N [self.identity] * 2 [self.identity] self.identity self identity 2 self.N self N self.lazy = [None] * 2 * self.N self.lazy self lazy [None] * 2 * self.N [None] * 2 [None] None 2 self.N self N self.opr = operation self.opr self opr operation for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
         i range(self.n) range self.n self n self.tree[i+self.N-1] = array[i] self.tree[i+self.N-1] self.tree self tree i+self.N-1 i+self.N i self.N self N 1 array[i] array i for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

     i range(self.N-2, -1, -1) range self.N-2 self.N self N 2 -1 -1 self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2]) self.tree[i] self.tree self tree i self.opr(self.tree[2*i+1], self.tree[2*i+2]) self.opr self opr self.tree[2*i+1] self.tree self tree 2*i+1 2*i 2 i 1 self.tree[2*i+2] self.tree self tree 2*i+2 2*i 2 i 2 self self array array operation=min operation min identity=10**30 identity 10**30 10 30 def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

     values for i in range(self.n-1):
            self.query(i, i+1)
         i range(self.n-1) range self.n-1 self.n self n 1 self.query(i, i+1) self.query self query i i+1 i 1 return self.tree[self.N-1:self.n+self.N-1] self.tree[self.N-1:self.n+self.N-1] self.tree self tree self.N-1:self.n+self.N-1 self.N-1 self.N self N 1 self.n+self.N-1 self.n+self.N self.n self n self.N self N 1 self self def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

     getindex l = (l + self.N) l l + self.N l self.N self N r = (r + self.N) r r + self.N r self.N self N lm = l // (l & -l) >> 1 lm l // (l & -l) >> 1 l // (l & -l) l l & -l l -l l 1 rm = r // (r & -r) >> 1 rm r // (r & -r) >> 1 r // (r & -r) r r & -r r -r r 1 while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
         r-l > 0 r-l r l 0 if r <= rm:
                yield r
             r <= rm r rm yield r r if l <= lm:
                yield l
             l <= lm l lm yield l l l = l >> 1 l l >> 1 l 1 r = r >> 1 r r >> 1 r 1 while l:
            yield l
            l = l >> 1

     l yield l l l = l >> 1 l l >> 1 l 1 self self l l r r def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

     propagates for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

     i reversed(indices) reversed indices i -= 1 i 1 v = self.lazy[i] v self.lazy[i] self.lazy self lazy i if v is None:
                continue
             v is None v None continue self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1 self.lazy[2*i+1] self.lazy self lazy 2*i+1 2*i 2 i 1 v >> 1 v 1 = self.tree[2*i+1] = v >> 1 self.tree[2*i+1] self.tree self tree 2*i+1 2*i 2 i 1 v >> 1 self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1 self.lazy[2*i+2] self.lazy self lazy 2*i+2 2*i 2 i 2 v >> 1 v 1 = self.tree[2*i+2] = v >> 1 self.tree[2*i+2] self.tree self tree 2*i+2 2*i 2 i 2 v >> 1 self.lazy[i] = None self.lazy[i] self.lazy self lazy i None self self *indices def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

     update if p == q:
            return None
         p == q p q return None None indices = tuple(self.getindex(p, q)) indices tuple(self.getindex(p, q)) tuple self.getindex(p, q) self.getindex self getindex p q self.propagates(*indices) self.propagates self propagates *indices indices p += self.N-1 p self.N-1 self.N self N 1 q += self.N-2 q self.N-2 self.N self N 2 while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
         q-p > 0 q-p q p 0 if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
             p % 2 == 0 p % 2 p 2 0 self.lazy[p] = self.tree[p] = x self.lazy[p] self.lazy self lazy p x = self.tree[p] = x self.tree[p] self.tree self tree p x if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
             q % 2 == 1 q % 2 q 2 1 self.lazy[q] = self.tree[q] = x self.lazy[q] self.lazy self lazy q x = self.tree[q] = x self.tree[q] self.tree self tree q x p = p//2 p p//2 p 2 q = q//2 - 1 q q//2 - 1 q//2 q 2 1 x <<= 1 x 1 if p == q:
            self.lazy[p] = self.tree[p] = x
         p == q p q self.lazy[p] = self.tree[p] = x self.lazy[p] self.lazy self lazy p x = self.tree[p] = x self.tree[p] self.tree self tree p x for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

     i indices i -= 1 i 1 self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2]) self.tree[i] self.tree self tree i self.opr(self.tree[2*i+1], self.tree[2*i+2]) self.opr self opr self.tree[2*i+1] self.tree self tree 2*i+1 2*i 2 i 1 self.tree[2*i+2] self.tree self tree 2*i+2 2*i 2 i 2 self self p p q q x x def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res query if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
         q <= p q p print("Oops!  That was no valid number.  Try again...") print "Oops!  That was no valid number.  Try again..." exit() exit self.propagates(*self.getindex(p, q)) self.propagates self propagates *self.getindex(p, q) self.getindex(p, q) self.getindex self getindex p q p += self.N-1 p self.N-1 self.N self N 1 q += self.N-2 q self.N-2 self.N self N 2 res = self.identity res self.identity self identity while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
         q-p > 0 q-p q p 0 if p % 2 == 0:
                res = self.opr(res, self.tree[p])
             p % 2 == 0 p % 2 p 2 0 res = self.opr(res, self.tree[p]) res self.opr(res, self.tree[p]) self.opr self opr res self.tree[p] self.tree self tree p if q % 2 == 1:
                res = self.opr(res, self.tree[q])
             q % 2 == 1 q % 2 q 2 1 res = self.opr(res, self.tree[q]) res self.opr(res, self.tree[q]) self.opr self opr res self.tree[q] self.tree self tree q p = p//2 p p//2 p 2 q = q//2 - 1 q q//2 - 1 q//2 q 2 1 if p == q:
            res = self.opr(res, self.tree[p])
         p == q p q res = self.opr(res, self.tree[p]) res self.opr(res, self.tree[p]) self.opr self opr res self.tree[p] self.tree self tree p return res res self self p p q q n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q Works = [] Works [] for _ in range(n):
    s, t, x = map(int, input().split())
    Works.append((s, 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 Works.append((s, t, x)) Works.append Works append (s, t, x) s t x Works = sorted(Works, key=lambda w: -w[2]) Works sorted(Works, key=lambda w: -w[2]) sorted Works key=lambda w: -w[2] key lambda w: -w[2] -w[2] w[2] w 2 w People = [] People [] for _ in range(q):
    People.append(int(input())) _ range(q) range q People.append(int(input())) People.append People append int(input()) int input() input ST = SegmentTree([-1]*q) ST SegmentTree([-1]*q) SegmentTree [-1]*q [-1] -1 q for s, t, x in Works:
    left = bisect_left(People, s-x)
    right = bisect_left(People, t-x)
    ST.update(left, right, x) s t x Works left = bisect_left(People, s-x) left bisect_left(People, s-x) bisect_left People s-x s x right = bisect_left(People, t-x) right bisect_left(People, t-x) bisect_left People t-x t x ST.update(left, right, x) ST.update ST update left right x for x in ST.values():
    print(x) x ST.values() ST.values ST values print(x) print x Works = [] [] Works left = bisect_left(People, s-x) bisect_left(People, s-x) left q = map(int, input().split()) map(int, input().split()) q s, t, x = map(int, input().split()) map(int, input().split()) s t, x = map(int, input().split()) map(int, input().split()) t class SegmentTree:  # 0-indexed
    def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

    def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

    def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

    def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res class SegmentTree:  # 0-indexed
    def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

    def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

    def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

    def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res SegmentTree right = bisect_left(People, t-x) bisect_left(People, t-x) right x = map(int, input().split()) map(int, input().split()) x Works = sorted(Works, key=lambda w: -w[2]) sorted(Works, key=lambda w: -w[2]) Works input = sys.stdin.readline sys.stdin.readline input ST = SegmentTree([-1]*q) SegmentTree([-1]*q) ST People = [] [] People n, q = map(int, input().split()) map(int, input().split()) n
# Solution using a lazy segment tree

from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


class SegmentTree:  # 0-indexed
    def __init__(self, array, operation=min, identity=10**30):
        self.identity = identity
        self.n = len(array)
        self.N = 1 << (self.n - 1).bit_length()
        self.tree = [self.identity] * 2 * self.N
        self.lazy = [None] * 2 * self.N
        self.opr = operation
        for i in range(self.n):
            self.tree[i+self.N-1] = array[i]
        for i in range(self.N-2, -1, -1):
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def values(self):
        for i in range(self.n-1):
            self.query(i, i+1)
        return self.tree[self.N-1:self.n+self.N-1]

    def getindex(self, l, r):
        l = (l + self.N)
        r = (r + self.N)
        lm = l // (l & -l) >> 1
        rm = r // (r & -r) >> 1
        while r-l > 0:
            if r <= rm:
                yield r
            if l <= lm:
                yield l
            l = l >> 1
            r = r >> 1
        while l:
            yield l
            l = l >> 1

    def propagates(self, *indices):
        for i in reversed(indices):
            i -= 1
            v = self.lazy[i]
            if v is None:
                continue
            self.lazy[2*i+1] = self.tree[2*i+1] = v >> 1
            self.lazy[2*i+2] = self.tree[2*i+2] = v >> 1
            self.lazy[i] = None

    def update(self, p, q, x):
        if p == q:
            return None
        indices = tuple(self.getindex(p, q))
        self.propagates(*indices)
        p += self.N-1
        q += self.N-2
        while q-p > 0:
            if p % 2 == 0:
                self.lazy[p] = self.tree[p] = x
            if q % 2 == 1:
                self.lazy[q] = self.tree[q] = x
            p = p//2
            q = q//2 - 1
            x <<= 1
        if p == q:
            self.lazy[p] = self.tree[p] = x
        for i in indices:
            i -= 1
            self.tree[i] = self.opr(self.tree[2*i+1], self.tree[2*i+2])

    def query(self, p, q):  # [p,q)
        if q <= p:
            print("Oops!  That was no valid number.  Try again...")
            exit()
        self.propagates(*self.getindex(p, q))
        p += self.N-1
        q += self.N-2
        res = self.identity
        while q-p > 0:
            if p % 2 == 0:
                res = self.opr(res, self.tree[p])
            if q % 2 == 1:
                res = self.opr(res, self.tree[q])
            p = p//2
            q = q//2 - 1
        if p == q:
            res = self.opr(res, self.tree[p])
        return res


n, q = map(int, input().split())

Works = []
for _ in range(n):
    s, t, x = map(int, input().split())
    Works.append((s, t, x))
Works = sorted(Works, key=lambda w: -w[2])

People = []
for _ in range(q):
    People.append(int(input()))

ST = SegmentTree([-1]*q)

for s, t, x in Works:
    left = bisect_left(People, s-x)
    right = bisect_left(People, t-x)
    ST.update(left, right, x)

for x in ST.values():
    print(x)
