import sys
from bisect import bisect_left



N,Q = map(int, input().split())
lines = sys.stdin.readlines()
kkk = []
for line in lines[:N]:
  s, t, x = map(int, line.split())
  kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[N:]))

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in kkk:
  ss = bisect_left(ddd, s - x)
  tt = bisect_left(ddd, 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 lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines kkk = [] kkk [] for line in lines[:N]:
  s, t, x = map(int, line.split())
  kkk.append((x, s, t)) line lines[:N] lines :N N s, t, x = map(int, line.split()) s map(int, line.split()) map int line.split() line.split line split t x kkk.append((x, s, t)) kkk.append kkk append (x, s, t) x s t kkk.sort() kkk.sort kkk sort ddd = list(map(int, lines[N:])) ddd list(map(int, lines[N:])) list map(int, lines[N:]) map int lines[N:] lines N: N ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q for x, s, t in kkk:
  ss = bisect_left(ddd, s - x)
  tt = bisect_left(ddd, 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 kkk ss = bisect_left(ddd, s - x) ss bisect_left(ddd, s - x) bisect_left ddd s - x s x tt = bisect_left(ddd, t - x) tt bisect_left(ddd, t - x) bisect_left ddd 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 N,Q = map(int, input().split()) map(int, input().split()) N ss = sk sk ss x = map(int, line.split()) map(int, line.split()) x skip = [-1] * Q [-1] * Q skip ans = [-1] * Q [-1] * Q ans ss = bisect_left(ddd, s - x) bisect_left(ddd, s - x) ss s, t, x = map(int, line.split()) map(int, line.split()) s ss += 1 1 ss kkk = [] [] kkk t, x = map(int, line.split()) map(int, line.split()) t ddd = list(map(int, lines[N:])) list(map(int, lines[N:])) ddd tt = bisect_left(ddd, t - x) bisect_left(ddd, t - x) tt Q = map(int, input().split()) map(int, input().split()) Q lines = sys.stdin.readlines() sys.stdin.readlines() lines sk = skip[ss] skip[ss] sk
import sys
from bisect import bisect_left



N,Q = map(int, input().split())
lines = sys.stdin.readlines()
kkk = []
for line in lines[:N]:
  s, t, x = map(int, line.split())
  kkk.append((x, s, t))
kkk.sort()
ddd = list(map(int, lines[N:]))

ans = [-1] * Q
skip = [-1] * Q
for x, s, t in kkk:
  ss = bisect_left(ddd, s - x)
  tt = bisect_left(ddd, 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)))
