import sys
input = lambda: sys.stdin.buffer.readline()
from bisect import bisect_left, bisect_right
INF = float("inf")

class LazySegmentTree:
    INF = float("inf")

    def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
    def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
    def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
    def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

    def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
    def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None

def main():
    n, q = map(int, input().split())
    query = [None] * n
    for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
    d = [int(input()) for _ in range(q)]
    lst = LazySegmentTree(q)

    query.sort(key=lambda x: x[2], reverse=True)

    for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

    for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans)

if __name__ == "__main__":
    main() import sys sys input = lambda: sys.stdin.buffer.readline() input lambda: sys.stdin.buffer.readline() sys.stdin.buffer.readline() sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline from bisect import bisect_left, bisect_right INF = float("inf") INF float("inf") float "inf" class LazySegmentTree:
    INF = float("inf")

    def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
    def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
    def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
    def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

    def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
    def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None LazySegmentTree INF = float("inf") INF float("inf") float "inf" def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
     __init__ self.n = 1 << (n-1).bit_length() self.n self n 1 << (n-1).bit_length() 1 (n-1).bit_length() n-1).bit_length n-1 n 1 bit_length self.data = [self.INF] * (self.n*2) self.data self data [self.INF] * (self.n*2) [self.INF] self.INF self INF self.n*2 self.n self n 2 self.lazy = [None] * (self.n*2) self.lazy self lazy [None] * (self.n*2) [None] None self.n*2 self.n self n 2 self self n n def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
     build for i, x in enumerate(data):
            self.data[self.n+i] = x
         i x enumerate(data) enumerate data self.data[self.n+i] = x self.data[self.n+i] self.data self data self.n+i self.n self n i x for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
     i range(self.n-1, 0, -1) range self.n-1 self.n self n 1 0 -1 self.data[i] = min(self.data[i*2], self.data[i*2+1]) self.data[i] self.data self data i min(self.data[i*2], self.data[i*2+1]) min self.data[i*2] self.data self data i*2 i 2 self.data[i*2+1] self.data self data i*2+1 i*2 i 2 1 self self data data def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
     query if not l < r: return self.INF
         not l < r l < r l r self.__propagate(self.__getidx(l, r)) self.__propagate self __propagate self.__getidx(l, r) self.__getidx self __getidx l r l += self.n l self.n self n r += self.n r self.n self n res = self.INF res self.INF self INF while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
         l < r l r if l & 1:
                res = min(res, self.data[l])
                l += 1
             l & 1 l 1 res = min(res, self.data[l]) res min(res, self.data[l]) min res self.data[l] self.data self data l l += 1 l 1 if r & 1:
                res = min(res, self.data[r-1])
             r & 1 r 1 res = min(res, self.data[r-1]) res min(res, self.data[r-1]) min res self.data[r-1] self.data self data r-1 r 1 l >>= 1 l 1 r >>= 1 r 1 return res res self self l l r r def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

     update if not l < r: return
         not l < r l < r l r idx = self.__getidx(l, r) idx self.__getidx(l, r) self.__getidx self __getidx l r self.__propagate(idx) self.__propagate self __propagate idx l += self.n l self.n self n r += self.n r self.n self n while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
         l < r l r if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
             l & 1 l 1 self.data[l], self.lazy[l] = x, x self.data[l] self.data self data l x self.lazy[l] self.lazy self lazy l x l += 1 l 1 if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
             r & 1 r 1 self.data[r-1], self.lazy[r-1] = x, x self.data[r-1] self.data self data r-1 r 1 x self.lazy[r-1] self.lazy self lazy r-1 r 1 x l >>= 1 l 1 r >>= 1 r 1 for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

     i idx self.data[i] = min(self.data[i*2], self.data[i*2+1]) self.data[i] self.data self data i min(self.data[i*2], self.data[i*2+1]) min self.data[i*2] self.data self data i*2 i 2 self.data[i*2+1] self.data self data i*2+1 i*2 i 2 1 self self l l r r x x def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
     __getidx l += self.n l self.n self n r += self.n r self.n self n lm = l // ((l & -l) << 1) lm l // ((l & -l) << 1) l (l & -l) << 1 l & -l l -l l 1 rm = r // ((r & -r) << 1) rm r // ((r & -r) << 1) r (r & -r) << 1 r & -r r -r r 1 res = [] res [] while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
         l < r l r if l <= lm: res.append(l)
             l <= lm l lm if r <= rm: res.append(r)
             r <= rm r rm l >>= 1 l 1 r >>= 1 r 1 while l:
            res.append(l)
            l >>= 1
         l res.append(l) res.append res append l l >>= 1 l 1 return res res self self l l r r def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None __propagate for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None i reversed(idx) reversed idx val = self.lazy[i] val self.lazy[i] self.lazy self lazy i if val is None: continue
             val is None val None self.lazy[i*2] = val self.lazy[i*2] self.lazy self lazy i*2 i 2 val self.lazy[i*2+1] = val self.lazy[i*2+1] self.lazy self lazy i*2+1 i*2 i 2 1 val self.data[i*2] = val self.data[i*2] self.data self data i*2 i 2 val self.data[i*2+1] = val self.data[i*2+1] self.data self data i*2+1 i*2 i 2 1 val self.lazy[i] = None self.lazy[i] self.lazy self lazy i None self self idx idx def main():
    n, q = map(int, input().split())
    query = [None] * n
    for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
    d = [int(input()) for _ in range(q)]
    lst = LazySegmentTree(q)

    query.sort(key=lambda x: x[2], reverse=True)

    for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

    for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans) main n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q query = [None] * n query [None] * n [None] None n for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
     i 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 query[i] = s-x, t-x, x query[i] query i query[i] = s-x, t-x, x s-x s x t-x t x x 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)] lst = LazySegmentTree(q) lst LazySegmentTree(q) LazySegmentTree q query.sort(key=lambda x: x[2], reverse=True) query.sort query sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse=True reverse True for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

     l r x query lst.update(bisect_left(d, l), bisect_left(d, r), x) lst.update lst update bisect_left(d, l) bisect_left d l bisect_left(d, r) bisect_left d r x for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans) i range(q) range q ans = lst.query(i, i+1) ans lst.query(i, i+1) lst.query lst query i i+1 i 1 print(-1 if ans == INF else ans) print -1 if ans == INF else ans ans == INF ans INF -1 ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main input = lambda: sys.stdin.buffer.readline() lambda: sys.stdin.buffer.readline() input class LazySegmentTree:
    INF = float("inf")

    def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
    def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
    def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
    def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

    def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
    def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None class LazySegmentTree:
    INF = float("inf")

    def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
    def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
    def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
    def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

    def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
    def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None LazySegmentTree INF = float("inf") float("inf") INF def main():
    n, q = map(int, input().split())
    query = [None] * n
    for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
    d = [int(input()) for _ in range(q)]
    lst = LazySegmentTree(q)

    query.sort(key=lambda x: x[2], reverse=True)

    for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

    for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans) def main():
    n, q = map(int, input().split())
    query = [None] * n
    for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
    d = [int(input()) for _ in range(q)]
    lst = LazySegmentTree(q)

    query.sort(key=lambda x: x[2], reverse=True)

    for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

    for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans) main
import sys
input = lambda: sys.stdin.buffer.readline()
from bisect import bisect_left, bisect_right
INF = float("inf")

class LazySegmentTree:
    INF = float("inf")

    def __init__(self, n):
        self.n = 1 << (n-1).bit_length()
        self.data = [self.INF] * (self.n*2)
        self.lazy = [None] * (self.n*2)
    
    def build(self, data):
        for i, x in enumerate(data):
            self.data[self.n+i] = x
        for i in range(self.n-1, 0, -1):
            self.data[i] = min(self.data[i*2], self.data[i*2+1])
        
    def query(self, l, r):
        if not l < r: return self.INF
        self.__propagate(self.__getidx(l, r))

        l += self.n; r += self.n 
        res = self.INF
        while l < r:
            if l & 1:
                res = min(res, self.data[l])
                l += 1
            if r & 1:
                res = min(res, self.data[r-1])
            l >>= 1; r >>= 1
        return res
    
    def update(self, l, r, x):
        if not l < r: return
        idx = self.__getidx(l, r)
        self.__propagate(idx)

        l += self.n; r += self.n 
        while l < r:
            if l & 1:
                self.data[l], self.lazy[l] = x, x
                l += 1
            if r & 1:
                self.data[r-1], self.lazy[r-1] = x, x
            l >>= 1; r >>= 1
    
        for i in idx:
            self.data[i] = min(self.data[i*2], self.data[i*2+1])

    def __getidx(self, l, r):
        l += self.n; r += self.n 
        lm = l // ((l & -l) << 1)
        rm = r // ((r & -r) << 1)
        res = []
        while l < r:
            if l <= lm: res.append(l)
            if r <= rm: res.append(r)
            l >>= 1; r >>= 1
        while l:
            res.append(l)
            l >>= 1
        return res
    
    def __propagate(self, idx):
        for i in reversed(idx):
            val = self.lazy[i]
            if val is None: continue
            self.lazy[i*2] = val; self.lazy[i*2+1] = val
            self.data[i*2] = val; self.data[i*2+1] = val
            self.lazy[i] = None

def main():
    n, q = map(int, input().split())
    query = [None] * n
    for i in range(n):
        s, t, x = map(int, input().split())
        query[i] = s-x, t-x, x
    d = [int(input()) for _ in range(q)]
    lst = LazySegmentTree(q)

    query.sort(key=lambda x: x[2], reverse=True)

    for l, r, x in query:
        lst.update(bisect_left(d, l), bisect_left(d, r), x)

    for i in range(q):
        ans = lst.query(i, i+1)
        print(-1 if ans == INF else ans)

if __name__ == "__main__":
    main()
