import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update(k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n,Q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split Q b_num = 2**(n-1).bit_length() b_num 2**(n-1).bit_length() 2 (n-1).bit_length() n-1).bit_length n-1 n 1 bit_length mx = 10**9 mx 10**9 10 9 segl=[mx]*2*b_num segl [mx]*2*b_num [mx]*2 [mx] mx 2 b_num def update(k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
     update k += b_num-1 k b_num-1 b_num 1 segl[k] = x segl[k] segl k x while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
     k+1 k 1 k = (k-1)//2 k (k-1)//2 k-1 k 1 2 segl[k] = min(segl[k*2+1],segl[k*2+2]) segl[k] segl k min(segl[k*2+1],segl[k*2+2]) min segl[k*2+1] segl k*2+1 k*2 k 2 1 segl[k*2+2] segl k*2+2 k*2 k 2 2 k k x x if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx) __name__ == '__main__' __name__ '__main__' xs = [] xs [] for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
     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 xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)] xs [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)] (s-x-0.4,True,x,i) s-x-0.4 s-x s x 0.4 True x i (t-x-0.5,False,x,i) t-x-0.5 t-x t x 0.5 False x i for _ in range(Q):
        xs.append((int(input()),2))
     _ range(Q) range Q xs.append((int(input()),2)) xs.append xs append (int(input()),2) int(input()) int input() input 2 xs.sort(key=lambda x:x[0]) xs.sort xs sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx) x xs if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
         x[1]==2 x[1] x 1 2 print(segl[0] if segl[0]!= mx else -1) print segl[0] if segl[0]!= mx else -1 segl[0]!= mx segl[0] segl 0 mx segl[0] segl 0 -1 continue update(x[3], x[2] if x[1] else mx) update x[3] x 3 x[2] if x[1] else mx x[1] x 1 x[2] x 2 mx xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)] [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)] xs mx = 10**9 10**9 mx x=map(int,input().split()) map(int,input().split()) x Q=map(int,input().split()) map(int,input().split()) Q n,Q=map(int,input().split()) map(int,input().split()) n t,x=map(int,input().split()) map(int,input().split()) t xs = [] [] xs def update(k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
     def update(k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
     update b_num = 2**(n-1).bit_length() 2**(n-1).bit_length() b_num segl=[mx]*2*b_num [mx]*2*b_num segl s,t,x=map(int,input().split()) map(int,input().split()) s input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update(k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)
