import sys
input = sys.stdin.buffer.readline # 入出力高速化

def main():
    N, Q = map(int, input().split())
    tl = [] # イベントタイムライン
    for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
    for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
    tl.sort()
    working = set() # 工事中
    wcur = 0 # 工事中の区域の数
    curmin = -1
    flag = False
    for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
    return
    
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 def main():
    N, Q = map(int, input().split())
    tl = [] # イベントタイムライン
    for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
    for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
    tl.sort()
    working = set() # 工事中
    wcur = 0 # 工事中の区域の数
    curmin = -1
    flag = False
    for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
    return
     main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tl = [] tl [] for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
     _ 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 tl.append((S-X, 1, X)) tl.append tl append (S-X, 1, X) S-X S X 1 X tl.append((T-X, 0, X)) tl.append tl append (T-X, 0, X) T-X T X 0 X for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
     _ range(Q) range Q D = int(input()) D int(input()) int input() input tl.append((D, 2, 0)) tl.append tl append (D, 2, 0) D 2 0 tl.sort() tl.sort tl sort working = set() working set() set wcur = 0 wcur 0 curmin = -1 curmin -1 flag = False flag False for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
     t c x tl if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
     c == 0 c 0 wcur -= 1 wcur 1 working.remove(x) working.remove working remove x if x <= curmin:
                curmin = x
                flag = True
         x <= curmin x curmin curmin = x curmin x flag = True flag True elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
         c == 1 c 1 wcur += 1 wcur 1 working.add(x) working.add working add x if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
         curmin < 0 or curmin >= x curmin < 0 curmin 0 curmin >= x curmin x curmin = x curmin x flag = False flag False if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
             wcur == 0 wcur 0 curmin = -1 curmin -1 flag = False flag False elif flag:
                curmin = min(working)
                flag = False
             flag curmin = min(working) curmin min(working) min working flag = False flag False print(curmin) print curmin return if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N, Q = map(int, input().split())
    tl = [] # イベントタイムライン
    for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
    for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
    tl.sort()
    working = set() # 工事中
    wcur = 0 # 工事中の区域の数
    curmin = -1
    flag = False
    for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
    return
     def main():
    N, Q = map(int, input().split())
    tl = [] # イベントタイムライン
    for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
    for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
    tl.sort()
    working = set() # 工事中
    wcur = 0 # 工事中の区域の数
    curmin = -1
    flag = False
    for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
    return
     main input = sys.stdin.buffer.readline sys.stdin.buffer.readline input
import sys
input = sys.stdin.buffer.readline # 入出力高速化

def main():
    N, Q = map(int, input().split())
    tl = [] # イベントタイムライン
    for _ in range(N):
        S, T, X = map(int, input().split())
        tl.append((S-X, 1, X)) # insert
        tl.append((T-X, 0, X)) # erase
    for _ in range(Q):
        D = int(input())
        tl.append((D, 2, 0)) # min
    tl.sort()
    working = set() # 工事中
    wcur = 0 # 工事中の区域の数
    curmin = -1
    flag = False
    for t, c, x in tl:
        if c == 0: # erase
            wcur -= 1
            working.remove(x)
            if x <= curmin:
                curmin = x
                flag = True
        elif c == 1: # insert
            wcur += 1
            working.add(x)
            if curmin < 0 or curmin >= x:
                curmin = x
                flag = False
        else: # min
            if wcur == 0:
                curmin = -1
                flag = False
            elif flag:
                curmin = min(working)
                flag = False
            print(curmin)
    return
    
if __name__ == "__main__":
    main()
