import sys
input = sys.stdin.readline

n, q = map(int, input().split())
events = []
for _ in range(n):
    s, t, x = map(int, input().split())
    events.append((s-x-0.5, 1, x)) # start construction
    events.append((t-x-0.5, -1, x)) # end construction

for i in range(q):
    d = int(input())
    events.append((d, 0, i)) # query
    
events = sorted(events)
is_stop = False
stops = set()
min_stop = float('inf')
ans = [-1]*q
for t, e, x in events: # time, event, distance/index
    if e > 0:
        stops.add(x)
        if x < min_stop:
            min_stop = x
            is_stop = True
    elif e < 0:
        stops.remove(x)
        if min_stop == x:
            is_stop = False
    elif len(stops) > 0:
        if not is_stop:
             min_stop = min(stops)
             is_stop = True
        ans[x] = min_stop
         
print('\n'.join(map(str, ans))) 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 events = [] events [] for _ in range(n):
    s, t, x = map(int, input().split())
    events.append((s-x-0.5, 1, x)) # start construction
    events.append((t-x-0.5, -1, x)) # end construction _ 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 events.append((s-x-0.5, 1, x)) events.append events append (s-x-0.5, 1, x) s-x-0.5 s-x s x 0.5 1 x events.append((t-x-0.5, -1, x)) events.append events append (t-x-0.5, -1, x) t-x-0.5 t-x t x 0.5 -1 x for i in range(q):
    d = int(input())
    events.append((d, 0, i)) # query
     i range(q) range q d = int(input()) d int(input()) int input() input events.append((d, 0, i)) events.append events append (d, 0, i) d 0 i events = sorted(events) events sorted(events) sorted events is_stop = False is_stop False stops = set() stops set() set min_stop = float('inf') min_stop float('inf') float 'inf' ans = [-1]*q ans [-1]*q [-1] -1 q for t, e, x in events: # time, event, distance/index
    if e > 0:
        stops.add(x)
        if x < min_stop:
            min_stop = x
            is_stop = True
    elif e < 0:
        stops.remove(x)
        if min_stop == x:
            is_stop = False
    elif len(stops) > 0:
        if not is_stop:
             min_stop = min(stops)
             is_stop = True
        ans[x] = min_stop
          t e x events if e > 0:
        stops.add(x)
        if x < min_stop:
            min_stop = x
            is_stop = True
    elif e < 0:
        stops.remove(x)
        if min_stop == x:
            is_stop = False
    elif len(stops) > 0:
        if not is_stop:
             min_stop = min(stops)
             is_stop = True
        ans[x] = min_stop
          e > 0 e 0 stops.add(x) stops.add stops add x if x < min_stop:
            min_stop = x
            is_stop = True
     x < min_stop x min_stop min_stop = x min_stop x is_stop = True is_stop True elif e < 0:
        stops.remove(x)
        if min_stop == x:
            is_stop = False
     e < 0 e 0 stops.remove(x) stops.remove stops remove x if min_stop == x:
            is_stop = False
     min_stop == x min_stop x is_stop = False is_stop False elif len(stops) > 0:
        if not is_stop:
             min_stop = min(stops)
             is_stop = True
        ans[x] = min_stop
          len(stops) > 0 len(stops) len stops 0 if not is_stop:
             min_stop = min(stops)
             is_stop = True
         not is_stop is_stop min_stop = min(stops) min_stop min(stops) min stops is_stop = True is_stop True ans[x] = min_stop ans[x] ans x min_stop print('\n'.join(map(str, ans))) print '\n'.join(map(str, ans)) '\n'.join '\n' join map(str, ans) map str ans is_stop = False False is_stop input = sys.stdin.readline sys.stdin.readline input d = int(input()) int(input()) d min_stop = float('inf') float('inf') min_stop n, q = map(int, input().split()) map(int, input().split()) n is_stop = True True is_stop min_stop = x x min_stop min_stop = min(stops) min(stops) min_stop events = [] [] events t, x = map(int, input().split()) map(int, input().split()) t events = sorted(events) sorted(events) events is_stop = False False is_stop stops = set() set() stops q = map(int, input().split()) map(int, input().split()) q s, t, x = map(int, input().split()) map(int, input().split()) s is_stop = True True is_stop x = map(int, input().split()) map(int, input().split()) x ans = [-1]*q [-1]*q ans
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
events = []
for _ in range(n):
    s, t, x = map(int, input().split())
    events.append((s-x-0.5, 1, x)) # start construction
    events.append((t-x-0.5, -1, x)) # end construction

for i in range(q):
    d = int(input())
    events.append((d, 0, i)) # query
    
events = sorted(events)
is_stop = False
stops = set()
min_stop = float('inf')
ans = [-1]*q
for t, e, x in events: # time, event, distance/index
    if e > 0:
        stops.add(x)
        if x < min_stop:
            min_stop = x
            is_stop = True
    elif e < 0:
        stops.remove(x)
        if min_stop == x:
            is_stop = False
    elif len(stops) > 0:
        if not is_stop:
             min_stop = min(stops)
             is_stop = True
        ans[x] = min_stop
         
print('\n'.join(map(str, ans)))