import sys
from heapq import *
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

    
if __name__ == "__main__":
    main() import sys sys from heapq import * input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

     main n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q key = [] key [] for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

     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 l, r = max(0, s-x), max(0, t-x) l max(0, s-x) max 0 s-x s x r max(0, t-x) max 0 t-x t x key.append((l, -1, x)) key.append key append (l, -1, x) l -1 x key.append((r, 1, x)) key.append key append (r, 1, x) r 1 x key.sort() key.sort key sort judge = [] judge [] already = dict() already dict() dict search = [] search [] for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

     i range(n*2) range n*2 n 2 s, j, x = key[i] s key[i] key i j x if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
         j == -1 j -1 heappush(judge, x) heappush judge x if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
         x in already x already already[x] += 1 already[x] already x 1 already[x] = 1 already[x] already x 1 if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

     i == n*2-1 or key[i][0] != key[i+1][0] i == n*2-1 i n*2-1 n*2 n 2 1 key[i][0] != key[i+1][0] key[i][0] [i] key i 0 key[i+1][0] [i+1] key i+1 i 1 0 while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
             judge if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
             judge[0] in already and already[judge[0]] > 0 judge[0] in already judge[0] judge 0 already already[judge[0]] > 0 already[judge[0]] already judge[0] judge 0 0 already[judge[0]] -= 1 already[judge[0]] already judge[0] judge 0 1 heappop(judge) heappop judge break if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

     judge search.append((s, judge[0])) search.append search append (s, judge[0]) s judge[0] judge 0 search.append((s, -1)) search.append search append (s, -1) s -1 size = len(search) size len(search) len search index = 0 index 0 answer = [] answer [] for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

     i range(q) range q d = int(input()) d int(input()) int input() input while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
         index < size-1 index size-1 size 1 if search[index+1][0] <= d:
                index += 1
            else:
                break
         search[index+1][0] <= d search[index+1][0] [index+1] search index+1 index 1 0 d index += 1 index 1 break print(search[index][1]) print search[index][1] [index] search index 1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main input = sys.stdin.readline sys.stdin.readline input def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

     def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

     main
import sys
from heapq import *
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, -1, x))
        key.append((r, 1, x))

    key.sort()
    judge = []
    already = dict()
    search = []
    
    for i in range(n*2):
        s, j, x = key[i]
        
        if j == -1:
            heappush(judge, x)
        else:
            if x in already:
                already[x] += 1
            else:
                already[x] = 1
        
        if i == n*2-1 or key[i][0] != key[i+1][0]:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                search.append((s, judge[0]))
            else:
                search.append((s, -1))

    size = len(search)
    index = 0
    answer = []
    for i in range(q):
        d = int(input())
        while index < size-1:
            if search[index+1][0] <= d:
                index += 1
            else:
                break
        print(search[index][1])

    
if __name__ == "__main__":
    main()