import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1

def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d


import heapq

n,q = readints()

X = []

block = []
free = []
for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x])

b,d = compress(X)
block = [(x[0],d[x[1]]) for x in block]
free = [(x[0],d[x[1]]) for x in free]
heapq.heapify(block)
heapq.heapify(free)

ans = []
avl = AVL_like_BIT(len(d))
for i in range(q):
    D = readint()
    while block and block[0][0]<=D:
        a = heapq.heappop(block)
        avl.add(a[1])
    while free and free[0][0]<=D:
        a = heapq.heappop(free)
        avl.delete(a[1])
    ans.append(avl.lower_bound(0))

ans = [b[x-1] if x >=0 else -1 for x in ans]
printrows(ans) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def readstr():return readline().rstrip().decode() readstr def readstrs():return list(readline().decode().split()) readstrs def readint():return int(readline()) readint def readints():return list(map(int,readline().split())) readints def printrows(x):print('\n'.join(map(str,x))) printrows x x def printline(x):print(' '.join(map(str,x))) printline x x class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1 AVL_like_BIT def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

     __init__ self.n = n self.n self n n self.tree = [0]*(self.n+1) self.tree self tree [0]*(self.n+1) [0] 0 self.n+1 self.n self n 1 self.depth = n.bit_length() self.depth self depth n.bit_length() n.bit_length n bit_length self self n n def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
     add while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
     k<=self.n k self.n self n self.tree[k]+=1 self.tree[k] self.tree self tree k 1 k += k&-k k k&-k k -k k self self k k def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

     delete while k<=self.n:
            self.tree[k]-=1
            k += k&-k

     k<=self.n k self.n self n self.tree[k]-=1 self.tree[k] self.tree self tree k 1 k += k&-k k k&-k k -k k self self k k def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
     sum ans = 0 ans 0 while k>0:
            ans += self.tree[k]
            k -= k&-k
         k>0 k 0 ans += self.tree[k] ans self.tree[k] self.tree self tree k k -= k&-k k k&-k k -k k return ans ans self self k k def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

     lower_bound x = self.sum(k-1) x self.sum(k-1) self.sum self sum k-1 k 1 if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
         x == self.sum(self.n) x self.sum(self.n) self.sum self sum self.n self n return -1 -1 p = 0 p 0 v = 1<<self.depth v 1<<self.depth 1 self.depth self depth for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
         i range(self.depth + 1) range self.depth + 1 self.depth self depth 1 q = p+v q p+v p v if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
             q <= self.n and self.tree[q] <= x q <= self.n q self.n self n self.tree[q] <= x self.tree[q] self.tree self tree q x x -= self.tree[q] x self.tree[q] self.tree self tree q p += v p v v>>=1 v 1 return p+1 p+1 p 1 self self k k def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

     upper_bound x = self.sum(k) x self.sum(k) self.sum self sum k if x == 0:  # k以下の要素がないときは-1を返す
            return -1
         x == 0 x 0 return -1 -1 p = 0 p 0 v = 1<<self.depth v 1<<self.depth 1 self.depth self depth for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
         i range(self.depth + 1) range self.depth + 1 self.depth self depth 1 q = p+v q p+v p v if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
             q <= self.n and self.tree[q] < x q <= self.n q self.n self n self.tree[q] < x self.tree[q] self.tree self tree q x x -= self.tree[q] x self.tree[q] self.tree self tree q p += v p v v>>=1 v 1 return p+1 p+1 p 1 self self k k def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1 query if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
         k > self.sum(self.n) k self.sum(self.n) self.sum self sum self.n self n return -1 -1 p = 0 p 0 v = 1<<self.depth v 1<<self.depth 1 self.depth self depth for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
         i range(self.depth + 1) range self.depth + 1 self.depth self depth 1 q = p+v q p+v p v if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
             q <= self.n and self.tree[q] < k q <= self.n q self.n self n self.tree[q] < k self.tree[q] self.tree self tree q k k -= self.tree[q] k self.tree[q] self.tree self tree q p += v p v v>>=1 v 1 return p+1 p+1 p 1 self self k k def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d compress b = sorted(set(a)) b sorted(set(a)) sorted set(a) set a x:i+1 for i,x in enumerate(b) for i,x in enumerate(b) i x enumerate(b) enumerate b for i,x in enumerate(b) x i+1 i 1 d = {x:i+1 for i,x in enumerate(b)} d {x:i+1 for i,x in enumerate(b)} return b,d return b,d b d a a import heapq heapq n,q = readints() n readints() readints q X = [] X [] block = [] block [] free = [] free [] for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x]) i range(n) range n s,t,x = readints() s readints() readints t x X.append(x) X.append X append x block.append([s-x,x]) block.append block append [s-x,x] s-x s x x free.append([t-x,x]) free.append free append [t-x,x] t-x t x x b,d = compress(X) b compress(X) compress X d (x[0],d[x[1]]) for x in block for x in block x block for x in block (x[0],d[x[1]]) x[0] x 0 d[x[1]] d x[1] x 1 block = [(x[0],d[x[1]]) for x in block] block [(x[0],d[x[1]]) for x in block] (x[0],d[x[1]]) for x in free for x in free x free for x in free (x[0],d[x[1]]) x[0] x 0 d[x[1]] d x[1] x 1 free = [(x[0],d[x[1]]) for x in free] free [(x[0],d[x[1]]) for x in free] heapq.heapify(block) heapq.heapify heapq heapify block heapq.heapify(free) heapq.heapify heapq heapify free ans = [] ans [] avl = AVL_like_BIT(len(d)) avl AVL_like_BIT(len(d)) AVL_like_BIT len(d) len d for i in range(q):
    D = readint()
    while block and block[0][0]<=D:
        a = heapq.heappop(block)
        avl.add(a[1])
    while free and free[0][0]<=D:
        a = heapq.heappop(free)
        avl.delete(a[1])
    ans.append(avl.lower_bound(0)) i range(q) range q D = readint() D readint() readint while block and block[0][0]<=D:
        a = heapq.heappop(block)
        avl.add(a[1])
     block and block[0][0]<=D block block[0][0]<=D block[0][0] [0] block 0 0 D a = heapq.heappop(block) a heapq.heappop(block) heapq.heappop heapq heappop block avl.add(a[1]) avl.add avl add a[1] a 1 while free and free[0][0]<=D:
        a = heapq.heappop(free)
        avl.delete(a[1])
     free and free[0][0]<=D free free[0][0]<=D free[0][0] [0] free 0 0 D a = heapq.heappop(free) a heapq.heappop(free) heapq.heappop heapq heappop free avl.delete(a[1]) avl.delete avl delete a[1] a 1 ans.append(avl.lower_bound(0)) ans.append ans append avl.lower_bound(0) avl.lower_bound avl lower_bound 0 b[x-1] if x >=0 else -1 for x in ans for x in ans x ans for x in ans b[x-1] if x >=0 else -1 x >=0 x 0 b[x-1] b x-1 x 1 -1 ans = [b[x-1] if x >=0 else -1 for x in ans] ans [b[x-1] if x >=0 else -1 for x in ans] printrows(ans) printrows ans def printline(x):print(' '.join(map(str,x))) def printline(x):print(' '.join(map(str,x))) printline a = heapq.heappop(free) heapq.heappop(free) a readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline d = compress(X) compress(X) d def printrows(x):print('\n'.join(map(str,x))) def printrows(x):print('\n'.join(map(str,x))) printrows D = readint() readint() D block = [(x[0],d[x[1]]) for x in block] [(x[0],d[x[1]]) for x in block] block avl = AVL_like_BIT(len(d)) AVL_like_BIT(len(d)) avl n,q = readints() readints() n ans = [b[x-1] if x >=0 else -1 for x in ans] [b[x-1] if x >=0 else -1 for x in ans] ans a = heapq.heappop(block) heapq.heappop(block) a s,t,x = readints() readints() s class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1 class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1 AVL_like_BIT q = readints() readints() q x = readints() readints() x b,d = compress(X) compress(X) b block = [] [] block t,x = readints() readints() t ans = [] [] ans X = [] [] X def readstr():return readline().rstrip().decode() def readstr():return readline().rstrip().decode() readstr free = [] [] free def readints():return list(map(int,readline().split())) def readints():return list(map(int,readline().split())) readints free = [(x[0],d[x[1]]) for x in free] [(x[0],d[x[1]]) for x in free] free def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d compress def readstrs():return list(readline().decode().split()) def readstrs():return list(readline().decode().split()) readstrs def readint():return int(readline()) def readint():return int(readline()) readint
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1

def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d


import heapq

n,q = readints()

X = []

block = []
free = []
for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x])

b,d = compress(X)
block = [(x[0],d[x[1]]) for x in block]
free = [(x[0],d[x[1]]) for x in free]
heapq.heapify(block)
heapq.heapify(free)

ans = []
avl = AVL_like_BIT(len(d))
for i in range(q):
    D = readint()
    while block and block[0][0]<=D:
        a = heapq.heappop(block)
        avl.add(a[1])
    while free and free[0][0]<=D:
        a = heapq.heappop(free)
        avl.delete(a[1])
    ans.append(avl.lower_bound(0))

ans = [b[x-1] if x >=0 else -1 for x in ans]
printrows(ans)
