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, 's', x)) # start construction
    events.append((t-x-0.5, 'e', x)) # end construction

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

for i in range(q):
    d = int(input())
    events.append((d, 'q', 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 == 's':
        stops.add(x)
        if x < min_stop:
            min_stop = x
            is_stop = True
    elif e == 'e':
        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
         
for a in ans:
    print(a)