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