# -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin



readl = stdin.readline

## input
N,Q = map(int, readl().rstrip().split())
STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]
Dn = [None for _ in range(Q+1)]
for i in range(Q):
  Dn[i] = int(readl().rstrip())
Dn[Q] = 10**10
ans = [-1] * (Q+1)
skip = [-1] * (Q+1)

for s,t,x in sorted(STX,key=lambda x:x[2]):
  l = bisect_left(Dn,s-x)
  r = bisect_left(Dn,t-x)
  while l < r:
    if skip[l] < 0:
      ans[l] = x
      skip[l] = r
      l += 1
    else:
      l = skip[l]

for d in ans[:-1]:
  print(d) from bisect import bisect_left from sys import stdin readl = stdin.readline readl stdin.readline stdin readline N,Q = map(int, readl().rstrip().split()) N map(int, readl().rstrip().split()) map int readl().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () readl rstrip split Q list(map(int, readl().rstrip().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, readl().rstrip().split())) list map(int, readl().rstrip().split()) map int readl().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () readl rstrip split STX = [list(map(int, readl().rstrip().split())) for _ in range(N)] STX [list(map(int, readl().rstrip().split())) for _ in range(N)] None for _ in range(Q+1) for _ in range(Q+1) _ range(Q+1) range Q+1 Q 1 for _ in range(Q+1) None Dn = [None for _ in range(Q+1)] Dn [None for _ in range(Q+1)] for i in range(Q):
  Dn[i] = int(readl().rstrip()) i range(Q) range Q Dn[i] = int(readl().rstrip()) Dn[i] Dn i int(readl().rstrip()) int readl().rstrip() ().rstrip () readl rstrip Dn[Q] = 10**10 Dn[Q] Dn Q 10**10 10 10 ans = [-1] * (Q+1) ans [-1] * (Q+1) [-1] -1 Q+1 Q 1 skip = [-1] * (Q+1) skip [-1] * (Q+1) [-1] -1 Q+1 Q 1 for s,t,x in sorted(STX,key=lambda x:x[2]):
  l = bisect_left(Dn,s-x)
  r = bisect_left(Dn,t-x)
  while l < r:
    if skip[l] < 0:
      ans[l] = x
      skip[l] = r
      l += 1
    else:
      l = skip[l] s t x sorted(STX,key=lambda x:x[2]) sorted STX key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x l = bisect_left(Dn,s-x) l bisect_left(Dn,s-x) bisect_left Dn s-x s x r = bisect_left(Dn,t-x) r bisect_left(Dn,t-x) bisect_left Dn t-x t x while l < r:
    if skip[l] < 0:
      ans[l] = x
      skip[l] = r
      l += 1
    else:
      l = skip[l] l < r l r if skip[l] < 0:
      ans[l] = x
      skip[l] = r
      l += 1
    else:
      l = skip[l] skip[l] < 0 skip[l] skip l 0 ans[l] = x ans[l] ans l x skip[l] = r skip[l] skip l r l += 1 l 1 l = skip[l] l skip[l] skip l for d in ans[:-1]:
  print(d) d ans[:-1] ans :-1 -1 print(d) print d Dn = [None for _ in range(Q+1)] [None for _ in range(Q+1)] Dn ans = [-1] * (Q+1) [-1] * (Q+1) ans STX = [list(map(int, readl().rstrip().split())) for _ in range(N)] [list(map(int, readl().rstrip().split())) for _ in range(N)] STX Q = map(int, readl().rstrip().split()) map(int, readl().rstrip().split()) Q r = bisect_left(Dn,t-x) bisect_left(Dn,t-x) r l = bisect_left(Dn,s-x) bisect_left(Dn,s-x) l l += 1 1 l readl = stdin.readline stdin.readline readl skip = [-1] * (Q+1) [-1] * (Q+1) skip N,Q = map(int, readl().rstrip().split()) map(int, readl().rstrip().split()) N l = skip[l] skip[l] l
# -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin



readl = stdin.readline

## input
N,Q = map(int, readl().rstrip().split())
STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]
Dn = [None for _ in range(Q+1)]
for i in range(Q):
  Dn[i] = int(readl().rstrip())
Dn[Q] = 10**10
ans = [-1] * (Q+1)
skip = [-1] * (Q+1)

for s,t,x in sorted(STX,key=lambda x:x[2]):
  l = bisect_left(Dn,s-x)
  r = bisect_left(Dn,t-x)
  while l < r:
    if skip[l] < 0:
      ans[l] = x
      skip[l] = r
      l += 1
    else:
      l = skip[l]

for d in ans[:-1]:
  print(d)