import sys
input = sys.stdin.buffer.readline
import heapq

def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort()
    ans = [-1]*Q
    use = set()
    stop = []
    
    for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num)

if __name__ == "__main__":
    main() import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline import heapq heapq def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort()
    ans = [-1]*Q
    use = set()
    stop = []
    
    for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num) main N,Q = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q event = [] event [] for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
     _ 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 event.append((s-x,1,x)) event.append event append (s-x,1,x) s-x s x 1 x event.append((t-x,0,x)) event.append event append (t-x,0,x) t-x t x 0 x for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
     i range(Q) range Q a = int(input()) a int(input()) int input() input event.append((a,2,i)) event.append event append (a,2,i) a 2 i event.sort() event.sort event sort ans = [-1]*Q ans [-1]*Q [-1] -1 Q use = set() use set() set stop = [] stop [] for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
     a b c event if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
     b == 1 b 1 use.add(c) use.add use add c heapq.heappush(stop,c) heapq.heappush heapq heappush stop c elif b == 0:
            use.remove(c)
         b == 0 b 0 use.remove(c) use.remove use remove c while stop and stop[0] not in use:
                heapq.heappop(stop)
             stop and stop[0] not in use stop stop[0] not in use stop[0] stop 0 use heapq.heappop(stop) heapq.heappop heapq heappop stop ans[c] = -1 if len(stop) == 0 else stop[0] ans[c] ans c -1 if len(stop) == 0 else stop[0] len(stop) == 0 len(stop) len stop 0 -1 stop[0] stop 0 for num in ans:
        print(num) num ans print(num) print num if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort()
    ans = [-1]*Q
    use = set()
    stop = []
    
    for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num) def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort()
    ans = [-1]*Q
    use = set()
    stop = []
    
    for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num) main input = sys.stdin.buffer.readline sys.stdin.buffer.readline input
import sys
input = sys.stdin.buffer.readline
import heapq

def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,1,x))
        event.append((t-x,0,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort()
    ans = [-1]*Q
    use = set()
    stop = []
    
    for a,b,c in event:
        if b == 1:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 0:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num)

if __name__ == "__main__":
    main()
