import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
    #1-indexed
    def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
    def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
    def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s]

N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
stx.sort(key = itemgetter(2))
D = [int(sys.stdin.readline()) for _ in range(Q)] 

T = DammyMap(D, D)
ans = [-1]*Q

for s, t, x in stx:
    tl = T.less(s - x)
    tr = T.less(t - x)
    d = tr - tl
    for _ in range(d):
        i = T.get(tl + 1)
        T.add(i, -1)
        ans[T.comp[i]-1] = x
print(*ans, sep = '\n') import sys sys from itertools import accumulate from collections import Counter from bisect import bisect as br, bisect_left as bl from operator import itemgetter class DammyMap:
    #1-indexed
    def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
    def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
    def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s] DammyMap def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
     __init__ self.X = B[:] self.X self X B[:] B : v : k for k, v in enumerate(D, 1) for k, v in enumerate(D, 1) k v enumerate(D, 1) enumerate D 1 for k, v in enumerate(D, 1) v k self.comp = {v : k for k, v in enumerate(D, 1)} self.comp self comp {v : k for k, v in enumerate(D, 1)} self.size = len(self.X) self.size self size len(self.X) len self.X self X self.tree = [0] * (self.size + 1) self.tree self tree [0] * (self.size + 1) [0] 0 self.size + 1 self.size self size 1 self.p = 2**(self.size.bit_length() - 1) self.p self p 2**(self.size.bit_length() - 1) 2 self.size.bit_length() - 1 self.size.bit_length() self.size.bit_length self.size self size bit_length 1 self.dep = self.size.bit_length() self.dep self dep self.size.bit_length() self.size.bit_length self.size self size bit_length CA = Counter(A) CA Counter(A) Counter A CA[self.X[i]] for i in range(self.size) for i in range(self.size) i range(self.size) range self.size self size for i in range(self.size) CA[self.X[i]] CA self.X[i] self.X self X i S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)])) S [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)])) [0] 0 list(accumulate([CA[self.X[i]] for i in range(self.size)])) list accumulate([CA[self.X[i]] for i in range(self.size)]) accumulate [CA[self.X[i]] for i in range(self.size)] for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
     i range(1, 1+self.size) range 1 1+self.size 1 self.size self size self.tree[i] = S[i] - S[i - (i&-i)] self.tree[i] self.tree self tree i S[i] - S[i - (i&-i)] S[i] S i S[i - (i&-i)] S i - (i&-i) i i&-i i -i i self self A A B B def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
     compress L2 = list(set(L)) L2 list(set(L)) list set(L) set L L2.sort() L2.sort L2 sort v : k for k, v in enumerate(L2, 1) for k, v in enumerate(L2, 1) k v enumerate(L2, 1) enumerate L2 1 for k, v in enumerate(L2, 1) v k C = {v : k for k, v in enumerate(L2, 1)} C {v : k for k, v in enumerate(L2, 1)} return L2, C return L2, C L2 C self self L L def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
     leng return self.count(self.size) self.count(self.size) self.count self count self.size self size self self def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
     count s = 0 s 0 while i > 0:
            s += self.tree[i]
            i -= i & -i
         i > 0 i 0 s += self.tree[i] s self.tree[i] self.tree self tree i i -= i & -i i i & -i i -i i return s s self self i i def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
     less i = bl(self.X, v) i bl(self.X, v) bl self.X self X v s = 0 s 0 while i > 0:
            s += self.tree[i]
            i -= i & -i
         i > 0 i 0 s += self.tree[i] s self.tree[i] self.tree self tree i i -= i & -i i i & -i i -i i return s s self self v v def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
     leq i = br(self.X, v) i br(self.X, v) br self.X self X v s = 0 s 0 while i > 0:
            s += self.tree[i]
            i -= i & -i
         i > 0 i 0 s += self.tree[i] s self.tree[i] self.tree self tree i i -= i & -i i i & -i i -i i return s s self self v v def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
     add i = self.comp[i] i self.comp[i] self.comp self comp i while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
     i <= self.size i self.size self size self.tree[i] += x self.tree[i] self.tree self tree i x i += i & -i i i & -i i -i i self self i i x x def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s] get if v <= 0:
            return -1
         v <= 0 v 0 return -1 -1 s = 0 s 0 k = self.p k self.p self p for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
         _ range(self.dep) range self.dep self dep if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
             s + k <= self.size and self.tree[s+k] < v s + k <= self.size s + k s k self.size self size self.tree[s+k] < v self.tree[s+k] self.tree self tree s+k s k v s += k s k v -= self.tree[s] v self.tree[s] self.tree self tree s k //= 2 k 2 return self.X[s] self.X[s] self.X self X s self self v v N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tuple(map(int, sys.stdin.readline().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, sys.stdin.readline().split())) tuple map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] stx [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] stx.sort(key = itemgetter(2)) stx.sort stx sort key = itemgetter(2) key itemgetter(2) itemgetter 2 int(sys.stdin.readline()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline D = [int(sys.stdin.readline()) for _ in range(Q)] D [int(sys.stdin.readline()) for _ in range(Q)] T = DammyMap(D, D) T DammyMap(D, D) DammyMap D D ans = [-1]*Q ans [-1]*Q [-1] -1 Q for s, t, x in stx:
    tl = T.less(s - x)
    tr = T.less(t - x)
    d = tr - tl
    for _ in range(d):
        i = T.get(tl + 1)
        T.add(i, -1)
        ans[T.comp[i]-1] = x s t x stx tl = T.less(s - x) tl T.less(s - x) T.less T less s - x s x tr = T.less(t - x) tr T.less(t - x) T.less T less t - x t x d = tr - tl d tr - tl tr tl for _ in range(d):
        i = T.get(tl + 1)
        T.add(i, -1)
        ans[T.comp[i]-1] = x _ range(d) range d i = T.get(tl + 1) i T.get(tl + 1) T.get T get tl + 1 tl 1 T.add(i, -1) T.add T add i -1 ans[T.comp[i]-1] = x ans[T.comp[i]-1] ans T.comp[i]-1 T.comp[i] T.comp T comp i 1 x print(*ans, sep = '\n') print *ans ans sep = '\n' sep '\n' ans = [-1]*Q [-1]*Q ans stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] stx tl = T.less(s - x) T.less(s - x) tl tr = T.less(t - x) T.less(t - x) tr class DammyMap:
    #1-indexed
    def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
    def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
    def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s] class DammyMap:
    #1-indexed
    def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
    def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
    def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s] DammyMap T = DammyMap(D, D) DammyMap(D, D) T d = tr - tl tr - tl d i = T.get(tl + 1) T.get(tl + 1) i D = [int(sys.stdin.readline()) for _ in range(Q)] [int(sys.stdin.readline()) for _ in range(Q)] D N, Q = map(int, input().split()) map(int, input().split()) N Q = map(int, input().split()) map(int, input().split()) Q
import sys
from itertools import accumulate
from collections import Counter
from bisect import bisect as br, bisect_left as bl
from operator import itemgetter
class DammyMap:
    #1-indexed
    def __init__(self, A, B):
        #Aに初期状態の要素をすべて入れる,Bは値域のリスト
        #self.X, self.comp = self.compress(B)
        self.X = B[:]
        self.comp = {v : k for k, v in enumerate(D, 1)}
        self.size = len(self.X)
        self.tree = [0] * (self.size + 1)
        self.p = 2**(self.size.bit_length() - 1)
        self.dep = self.size.bit_length()
        
        CA = Counter(A)
        S = [0] + list(accumulate([CA[self.X[i]] for i in range(self.size)]))
        for i in range(1, 1+self.size):
            self.tree[i] = S[i] - S[i - (i&-i)]
        
    def compress(self, L):
        #座圧
        L2 = list(set(L))
        L2.sort()
        C = {v : k for k, v in enumerate(L2, 1)}
        # 1-indexed
        return L2, C
    
    def leng(self):
        #今入っている個数を取得
        return self.count(self.size)
    
    def count(self, i):
        #i(Bの元)以下の個数を取得
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def less(self, v):
        #v(Bの元である必要はない)未満の個数を取得
        i = bl(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def leq(self, v):
        #v(Bの元である必要はない)以下の個数を取得
        i = br(self.X, v)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        #iをx個入れる,負のxで取り出す,iの個数以上取り出すとエラーを出さずにバグる
        i = self.comp[i]
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
        
        
    def get(self, v):
        # v番目の値を取得
        if v <= 0:
            return -1
        s = 0
        k = self.p
        for _ in range(self.dep):
            if s + k <= self.size and self.tree[s+k] < v:
                s += k
                v -= self.tree[s]
            k //= 2
        return self.X[s]

N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
stx.sort(key = itemgetter(2))
D = [int(sys.stdin.readline()) for _ in range(Q)] 

T = DammyMap(D, D)
ans = [-1]*Q

for s, t, x in stx:
    tl = T.less(s - x)
    tr = T.less(t - x)
    d = tr - tl
    for _ in range(d):
        i = T.get(tl + 1)
        T.add(i, -1)
        ans[T.comp[i]-1] = x
print(*ans, sep = '\n')