import sys
from bisect import bisect_left



N,Q = map(int, input().split())
STX = [None] * N
for i in range(N):
  s,t,x = map(int, input().split())
  STX[i] = [x,s,t]
STX.sort()
Dn = [None] * (Q+1)
for i in range(Q):
  Dn[i] = int(input())
Dn[Q] = 10**10

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in STX:
  ss = bisect_left(Dn, s - x)
  tt = bisect_left(Dn, t - x)
  while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk

print('\n'.join(map(str, ans))) import sys sys from bisect import bisect_left N,Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q STX = [None] * N STX [None] * N [None] None N for i in range(N):
  s,t,x = map(int, input().split())
  STX[i] = [x,s,t] 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 STX[i] = [x,s,t] STX[i] STX i [x,s,t] x s t STX.sort() STX.sort STX sort Dn = [None] * (Q+1) Dn [None] * (Q+1) [None] None Q+1 Q 1 for i in range(Q):
  Dn[i] = int(input()) i range(Q) range Q Dn[i] = int(input()) Dn[i] Dn i int(input()) int input() input Dn[Q] = 10**10 Dn[Q] Dn Q 10**10 10 10 ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q for x, s, t in STX:
  ss = bisect_left(Dn, s - x)
  tt = bisect_left(Dn, t - x)
  while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk x s t STX ss = bisect_left(Dn, s - x) ss bisect_left(Dn, s - x) bisect_left Dn s - x s x tt = bisect_left(Dn, t - x) tt bisect_left(Dn, t - x) bisect_left Dn t - x t x while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk ss < tt ss tt sk = skip[ss] sk skip[ss] skip ss if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk sk == -1 sk -1 ans[ss] = x ans[ss] ans ss x skip[ss] = tt skip[ss] skip ss tt ss += 1 ss 1 ss = sk ss sk print('\n'.join(map(str, ans))) print '\n'.join(map(str, ans)) '\n'.join '\n' join map(str, ans) map str ans s,t,x = map(int, input().split()) map(int, input().split()) s STX = [None] * N [None] * N STX ss = bisect_left(Dn, s - x) bisect_left(Dn, s - x) ss ss += 1 1 ss Dn = [None] * (Q+1) [None] * (Q+1) Dn x = map(int, input().split()) map(int, input().split()) x ans = [-1] * Q [-1] * Q ans ss = sk sk ss t,x = map(int, input().split()) map(int, input().split()) t tt = bisect_left(Dn, t - x) bisect_left(Dn, t - x) tt Q = map(int, input().split()) map(int, input().split()) Q N,Q = map(int, input().split()) map(int, input().split()) N skip = [-1] * Q [-1] * Q skip sk = skip[ss] skip[ss] sk
import sys
from bisect import bisect_left



N,Q = map(int, input().split())
STX = [None] * N
for i in range(N):
  s,t,x = map(int, input().split())
  STX[i] = [x,s,t]
STX.sort()
Dn = [None] * (Q+1)
for i in range(Q):
  Dn[i] = int(input())
Dn[Q] = 10**10

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in STX:
  ss = bisect_left(Dn, s - x)
  tt = bisect_left(Dn, t - x)
  while ss < tt:
    sk = skip[ss]
    if sk == -1:
      ans[ss] = x
      skip[ss] = tt
      ss += 1
    else:
      ss = sk

print('\n'.join(map(str, ans)))
