import sys
input = sys.stdin.readline
ri = lambda: int(input())
rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
rl = lambda: map(int, input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7


N,Q=rl()
TT = []
now = set()
for _ in range(N):
    s,t,x = rl()
    TT.append((s-x-0.5,1,x))
    TT.append((t-x-0.5,-1,x))
for i in range(Q):
    d = ri()
    TT.append((d,0,i))


TT.sort()
mx = INF
mx_f = False
ans = [-1]*Q
for st,w,x in TT:
    if w > 0:
        now.add(x)
        if mx > x:
            mx = x
            mx_f = True
    elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
    elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx
print(*ans,sep='\n') import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline ri = lambda: int(input()) ri lambda: int(input()) int(input()) int input() input int(x) if x.isdecimal() else x for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) if x.isdecimal() else x x.isdecimal() x.isdecimal x isdecimal int(x) int x x rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()] rl lambda: [int(x) if x.isdecimal() else x for x in input().split()] [int(x) if x.isdecimal() else x for x in input().split()] rl = lambda: map(int, input().split()) rl lambda: map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split list(l) for l in zip(*[rl() for _ in range(N)]) for l in zip(*[rl() for _ in range(N)]) l zip(*[rl() for _ in range(N)]) zip *[rl() for _ in range(N)] [rl() for _ in range(N)] for l in zip(*[rl() for _ in range(N)]) list(l) list l rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])] rr lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])] [list(l) for l in zip(*[rl() for _ in range(N)])] N YN = lambda b: print('YES') if b else print('NO') YN lambda b: print('YES') if b else print('NO') print('YES') if b else print('NO') b print('YES') print 'YES' print('NO') print 'NO' b yn = lambda b: print('Yes') if b else print('No') yn lambda b: print('Yes') if b else print('No') print('Yes') if b else print('No') b print('Yes') print 'Yes' print('No') print 'No' b OE = lambda x: print('Odd') if x%2 else print('Even') OE lambda x: print('Odd') if x%2 else print('Even') print('Odd') if x%2 else print('Even') x%2 x 2 print('Odd') print 'Odd' print('Even') print 'Even' x INF = 10**18 INF 10**18 10 18 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 N,Q=rl() N rl() rl Q TT = [] TT [] now = set() now set() set for _ in range(N):
    s,t,x = rl()
    TT.append((s-x-0.5,1,x))
    TT.append((t-x-0.5,-1,x)) _ range(N) range N s,t,x = rl() s rl() rl t x TT.append((s-x-0.5,1,x)) TT.append TT append (s-x-0.5,1,x) s-x-0.5 s-x s x 0.5 1 x TT.append((t-x-0.5,-1,x)) TT.append TT 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 = ri()
    TT.append((d,0,i)) i range(Q) range Q d = ri() d ri() ri TT.append((d,0,i)) TT.append TT append (d,0,i) d 0 i TT.sort() TT.sort TT sort mx = INF mx INF mx_f = False mx_f False ans = [-1]*Q ans [-1]*Q [-1] -1 Q for st,w,x in TT:
    if w > 0:
        now.add(x)
        if mx > x:
            mx = x
            mx_f = True
    elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
    elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx st w x TT if w > 0:
        now.add(x)
        if mx > x:
            mx = x
            mx_f = True
    elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
    elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx w > 0 w 0 now.add(x) now.add now add x if mx > x:
            mx = x
            mx_f = True
     mx > x mx x mx = x mx x mx_f = True mx_f True elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
     w < 0 w 0 now.remove(x) now.remove now remove x if mx == x:
            mx_f = False
     mx == x mx x mx_f = False mx_f False elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx len(now) > 0 len(now) len now 0 if not mx_f:
            mx = min(now)
            mx_f = True
         not mx_f mx_f mx = min(now) mx min(now) min now mx_f = True mx_f True ans[x] = mx ans[x] ans x mx print(*ans,sep='\n') print *ans ans sep='\n' sep '\n' mx = min(now) min(now) mx YN = lambda b: print('YES') if b else print('NO') lambda b: print('YES') if b else print('NO') YN MOD = 10**9+7 10**9+7 MOD x = rl() rl() x mx_f = False False mx_f ans = [-1]*Q [-1]*Q ans rl = lambda: map(int, input().split()) lambda: map(int, input().split()) rl N,Q=rl() rl() N d = ri() ri() d t,x = rl() rl() t input = sys.stdin.readline sys.stdin.readline input rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])] lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])] rr s,t,x = rl() rl() s TT = [] [] TT mx_f = True True mx_f ri = lambda: int(input()) lambda: int(input()) ri INF = 10**18 10**18 INF mx_f = True True mx_f mx_f = False False mx_f OE = lambda x: print('Odd') if x%2 else print('Even') lambda x: print('Odd') if x%2 else print('Even') OE Q=rl() rl() Q rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()] lambda: [int(x) if x.isdecimal() else x for x in input().split()] rl mx = INF INF mx mx = x x mx yn = lambda b: print('Yes') if b else print('No') lambda b: print('Yes') if b else print('No') yn now = set() set() now
import sys
input = sys.stdin.readline
ri = lambda: int(input())
rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
rl = lambda: map(int, input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7


N,Q=rl()
TT = []
now = set()
for _ in range(N):
    s,t,x = rl()
    TT.append((s-x-0.5,1,x))
    TT.append((t-x-0.5,-1,x))
for i in range(Q):
    d = ri()
    TT.append((d,0,i))


TT.sort()
mx = INF
mx_f = False
ans = [-1]*Q
for st,w,x in TT:
    if w > 0:
        now.add(x)
        if mx > x:
            mx = x
            mx_f = True
    elif w < 0:
        now.remove(x)
        if mx == x:
            mx_f = False
    elif len(now) > 0:
        if not mx_f:
            mx = min(now)
            mx_f = True
        ans[x] = mx
print(*ans,sep='\n')